Hey all - figured I'd reach out with a question I'm running into and see if anyone has some good ideas. I'm currently working on unit tests for my map service (Angular) and am having some problems running tests when incorporating watchUtils. Here's the pertinent code.
whenFalse(this.view, 'stationary', () => {
const beginScale: number = this.view.get('scale');
const beginExtent: __esri.Extent = this.view.get('extent');
whenTrueOnce(this.view, 'stationary', () => {
const currentScale: number = this.view.get('scale');
const endExtent: __esri.Extent = this.view.get('extent');
const willWaitForIndividualAssets = this.view.zoom >= this.levelToRenderIndividualAssetsOnMap;
const wasMovement = (currentScale !== beginScale || !beginExtent.equals(endExtent))
if (wasMovement && !willWaitForIndividualAssets) {
this.handleZoom(willWaitForIndividualAssets);
}
if (wasMovement && willWaitForIndividualAssets) {
this.boundingBoxUpdate$.next(this.getBoundingBox());
this.waitForIndividualAssetSites();
}
});
});
I've tried firing off a few events with no luck - so I'm wondering if anyone has any advice on how to get the watchUtils to actually trigger here within a unit test so I can test this stuff. Thanks!