Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
resolutions: testResolutions
});
const wrapper = TestUtil.mountComponent(ScaleCombo, {
scales: [],
map: map
});
// Reset the scales array, as getOptionsFromMap() will be called in
// constructor.
wrapper.setState({'scales': []});
const scales = wrapper.instance().getOptionsFromMap();
expect(scales).toBeInstanceOf(Array);
expect(scales).toHaveLength(testResolutions.length);
let roundScale = (Math.round(MapUtil.getScaleForResolution(
testResolutions[testResolutions.length - 1] ,'m')));
expect(scales[0]).toBe(roundScale);
TestUtil.removeMap(map);
});
pushScale = (scales: string[], resolution: number, view: OlView) => {
let scale = MapUtil.getScaleForResolution(resolution, view.getProjection().getUnits());
const roundScale = MapUtil.roundScale(scale);
if (scales.includes(roundScale) ) {
return;
}
scales.push(roundScale);
}