<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Unit Testing with WatchUtils in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unit-testing-with-watchutils/m-p/1201272#M78241</link>
    <description>&lt;P&gt;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.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;      whenFalse(this.view, 'stationary', () =&amp;gt; {
        const beginScale: number = this.view.get('scale');
        const beginExtent: __esri.Extent = this.view.get('extent');
        whenTrueOnce(this.view, 'stationary', () =&amp;gt; {
          const currentScale: number = this.view.get('scale');
          const endExtent: __esri.Extent = this.view.get('extent');
          const willWaitForIndividualAssets = this.view.zoom &amp;gt;= this.levelToRenderIndividualAssetsOnMap;
          const wasMovement = (currentScale !== beginScale || !beginExtent.equals(endExtent))
          if (wasMovement &amp;amp;&amp;amp; !willWaitForIndividualAssets) {
            this.handleZoom(willWaitForIndividualAssets);
          }
          if (wasMovement &amp;amp;&amp;amp; willWaitForIndividualAssets) {
            this.boundingBoxUpdate$.next(this.getBoundingBox());
            this.waitForIndividualAssetSites();
          }
        });
      });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;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!&lt;/P&gt;</description>
    <pubDate>Wed, 10 Aug 2022 13:23:44 GMT</pubDate>
    <dc:creator>rogenjh</dc:creator>
    <dc:date>2022-08-10T13:23:44Z</dc:date>
    <item>
      <title>Unit Testing with WatchUtils</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unit-testing-with-watchutils/m-p/1201272#M78241</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;      whenFalse(this.view, 'stationary', () =&amp;gt; {
        const beginScale: number = this.view.get('scale');
        const beginExtent: __esri.Extent = this.view.get('extent');
        whenTrueOnce(this.view, 'stationary', () =&amp;gt; {
          const currentScale: number = this.view.get('scale');
          const endExtent: __esri.Extent = this.view.get('extent');
          const willWaitForIndividualAssets = this.view.zoom &amp;gt;= this.levelToRenderIndividualAssetsOnMap;
          const wasMovement = (currentScale !== beginScale || !beginExtent.equals(endExtent))
          if (wasMovement &amp;amp;&amp;amp; !willWaitForIndividualAssets) {
            this.handleZoom(willWaitForIndividualAssets);
          }
          if (wasMovement &amp;amp;&amp;amp; willWaitForIndividualAssets) {
            this.boundingBoxUpdate$.next(this.getBoundingBox());
            this.waitForIndividualAssetSites();
          }
        });
      });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;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!&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 13:23:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unit-testing-with-watchutils/m-p/1201272#M78241</guid>
      <dc:creator>rogenjh</dc:creator>
      <dc:date>2022-08-10T13:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Unit Testing with WatchUtils</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unit-testing-with-watchutils/m-p/1201329#M78246</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/433865"&gt;@rogenjh&lt;/a&gt;&amp;nbsp; Here's a basic codepen using reactiveUtils to show the concept: &lt;A href="https://codepen.io/andygup/pen/ZExjMZq?editors=1000" target="_blank" rel="noopener"&gt;https://codepen.io/andygup/pen/ZExjMZq?editors=1000&lt;/A&gt;. MapView.interacting might be a better property for your use case. We recommend using reactiveUtils instead of watchUtils, here's the doc &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html&lt;/A&gt;. watchUtils have been deprecated.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 14:36:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unit-testing-with-watchutils/m-p/1201329#M78246</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2022-08-10T14:36:02Z</dc:date>
    </item>
  </channel>
</rss>

