@trackunit/react-vite-test-setup 0.0.145 → 0.0.147

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -157,6 +157,23 @@ const ensureJestGlobalAlias = () => {
157
157
  globalAny.jest = vitest.vi;
158
158
  }
159
159
  };
160
+ /**
161
+ * `@googlemaps/jest-mocks`' initialize() does not register TrafficLayer on
162
+ * `google.maps` (it only exists behind its importLibrary mock), so tests get
163
+ * a minimal fake with the setMap/getMap surface the Google adapter uses.
164
+ * Module-scoped so its prototype stays stable across tests for spying.
165
+ */
166
+ class TrafficLayerFake {
167
+ constructor() {
168
+ this.attachedMap = null;
169
+ }
170
+ setMap(map) {
171
+ this.attachedMap = map;
172
+ }
173
+ getMap() {
174
+ return this.attachedMap;
175
+ }
176
+ }
160
177
  /**
161
178
  * Sets up mocks for Google Maps API and @vis.gl/react-google-maps components
162
179
  * in testing environments.
@@ -263,6 +280,7 @@ const setupGoogleMaps = () => {
263
280
  }),
264
281
  },
265
282
  };
283
+ Object.assign(global.window.google.maps, { TrafficLayer: TrafficLayerFake });
266
284
  });
267
285
  };
268
286
 
package/index.esm.js CHANGED
@@ -136,6 +136,23 @@ const ensureJestGlobalAlias = () => {
136
136
  globalAny.jest = vi;
137
137
  }
138
138
  };
139
+ /**
140
+ * `@googlemaps/jest-mocks`' initialize() does not register TrafficLayer on
141
+ * `google.maps` (it only exists behind its importLibrary mock), so tests get
142
+ * a minimal fake with the setMap/getMap surface the Google adapter uses.
143
+ * Module-scoped so its prototype stays stable across tests for spying.
144
+ */
145
+ class TrafficLayerFake {
146
+ constructor() {
147
+ this.attachedMap = null;
148
+ }
149
+ setMap(map) {
150
+ this.attachedMap = map;
151
+ }
152
+ getMap() {
153
+ return this.attachedMap;
154
+ }
155
+ }
139
156
  /**
140
157
  * Sets up mocks for Google Maps API and @vis.gl/react-google-maps components
141
158
  * in testing environments.
@@ -242,6 +259,7 @@ const setupGoogleMaps = () => {
242
259
  }),
243
260
  },
244
261
  };
262
+ Object.assign(global.window.google.maps, { TrafficLayer: TrafficLayerFake });
245
263
  });
246
264
  };
247
265
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@trackunit/react-vite-test-setup",
3
3
  "description": "Test setup utilities for React applications",
4
- "version": "0.0.145",
4
+ "version": "0.0.147",
5
5
  "repository": "https://github.com/Trackunit/manager",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
7
7
  "engines": {