Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const wrapper = TestUtil.mountComponent(ScaleCombo, {
map: map,
scales: [],
resolutionsFilter
});
// 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(expectedLength);
let roundScale = MapUtil.roundScale(MapUtil.getScaleForResolution(
testResolutions[testResolutions.length - 2] ,'m'));
expect(scales[1]).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);
}