@trackunit/react-vite-test-setup 0.0.149-alpha-7fd06f36b49.0 → 0.0.149-alpha-f60e0f7c192.0
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 +0 -24
- package/index.esm.js +0 -24
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -157,23 +157,6 @@ 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
|
-
}
|
|
177
160
|
/**
|
|
178
161
|
* Sets up mocks for Google Maps API and @vis.gl/react-google-maps components
|
|
179
162
|
* in testing environments.
|
|
@@ -280,7 +263,6 @@ const setupGoogleMaps = () => {
|
|
|
280
263
|
}),
|
|
281
264
|
},
|
|
282
265
|
};
|
|
283
|
-
Object.assign(global.window.google.maps, { TrafficLayer: TrafficLayerFake });
|
|
284
266
|
});
|
|
285
267
|
};
|
|
286
268
|
|
|
@@ -843,12 +825,6 @@ vitest.afterEach(async () => {
|
|
|
843
825
|
vitest.vi.clearAllMocks();
|
|
844
826
|
react.cleanup();
|
|
845
827
|
await flushPromisesInAct();
|
|
846
|
-
// jsdom keeps window.history across tests in a file. Reset after cleanup() so any
|
|
847
|
-
// router history has been destroyed and this is not seen as a navigation. Some specs
|
|
848
|
-
// replace window.history with a stub that has no replaceState.
|
|
849
|
-
if (typeof window !== "undefined" && typeof window.history.replaceState === "function") {
|
|
850
|
-
window.history.replaceState(null, "", "/");
|
|
851
|
-
}
|
|
852
828
|
});
|
|
853
829
|
const setupResponseForTanstackRouter = () => {
|
|
854
830
|
// Polyfill for Response global that TanStack Router v1+ requires
|
package/index.esm.js
CHANGED
|
@@ -136,23 +136,6 @@ 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
|
-
}
|
|
156
139
|
/**
|
|
157
140
|
* Sets up mocks for Google Maps API and @vis.gl/react-google-maps components
|
|
158
141
|
* in testing environments.
|
|
@@ -259,7 +242,6 @@ const setupGoogleMaps = () => {
|
|
|
259
242
|
}),
|
|
260
243
|
},
|
|
261
244
|
};
|
|
262
|
-
Object.assign(global.window.google.maps, { TrafficLayer: TrafficLayerFake });
|
|
263
245
|
});
|
|
264
246
|
};
|
|
265
247
|
|
|
@@ -822,12 +804,6 @@ afterEach(async () => {
|
|
|
822
804
|
vi.clearAllMocks();
|
|
823
805
|
cleanup();
|
|
824
806
|
await flushPromisesInAct();
|
|
825
|
-
// jsdom keeps window.history across tests in a file. Reset after cleanup() so any
|
|
826
|
-
// router history has been destroyed and this is not seen as a navigation. Some specs
|
|
827
|
-
// replace window.history with a stub that has no replaceState.
|
|
828
|
-
if (typeof window !== "undefined" && typeof window.history.replaceState === "function") {
|
|
829
|
-
window.history.replaceState(null, "", "/");
|
|
830
|
-
}
|
|
831
807
|
});
|
|
832
808
|
const setupResponseForTanstackRouter = () => {
|
|
833
809
|
// Polyfill for Response global that TanStack Router v1+ requires
|
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.149-alpha-
|
|
4
|
+
"version": "0.0.149-alpha-f60e0f7c192.0",
|
|
5
5
|
"repository": "https://github.com/Trackunit/manager",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
7
7
|
"engines": {
|