@trackunit/react-core-contexts-test 1.7.34 → 1.7.37
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 +27 -3
- package/index.esm.js +27 -3
- package/package.json +5 -5
- package/src/TrackunitProvidersMockBuilder.d.ts +1 -1
- package/src/utils/routingUtils.d.ts +1 -1
package/index.cjs.js
CHANGED
|
@@ -222,7 +222,7 @@ const mockNavigationContext = {
|
|
|
222
222
|
gotoAdmin: (url) => {
|
|
223
223
|
return Promise.resolve(true);
|
|
224
224
|
},
|
|
225
|
-
|
|
225
|
+
gotoAlerts: (url) => {
|
|
226
226
|
return Promise.resolve(true);
|
|
227
227
|
},
|
|
228
228
|
gotoMarketplace: () => {
|
|
@@ -231,6 +231,30 @@ const mockNavigationContext = {
|
|
|
231
231
|
reloadManager: () => {
|
|
232
232
|
return Promise.resolve(true);
|
|
233
233
|
},
|
|
234
|
+
getAssetHomeUrl: (assetId, options) => {
|
|
235
|
+
return Promise.resolve(`/assets/${assetId}/status`);
|
|
236
|
+
},
|
|
237
|
+
getSiteHomeUrl: (siteId, options) => {
|
|
238
|
+
return Promise.resolve(`/sites/${siteId}/overview`);
|
|
239
|
+
},
|
|
240
|
+
getCustomerHomeUrl: (customerId, options) => {
|
|
241
|
+
return Promise.resolve(customerId ? `/customers/${customerId}/info` : `/customers`);
|
|
242
|
+
},
|
|
243
|
+
getAppLibraryUrl: irisAppId => {
|
|
244
|
+
return Promise.resolve(`/administration/app-library`);
|
|
245
|
+
},
|
|
246
|
+
getFleetAppUrl: options => {
|
|
247
|
+
return Promise.resolve(`/fleet`);
|
|
248
|
+
},
|
|
249
|
+
getAdminUrl: url => {
|
|
250
|
+
return Promise.resolve(url ? `/administration${url}` : `/administration`);
|
|
251
|
+
},
|
|
252
|
+
getAlertsUrl: url => {
|
|
253
|
+
return Promise.resolve(url ? `/event-setup${url}` : `/event-setup`);
|
|
254
|
+
},
|
|
255
|
+
getMarketplaceUrl: options => {
|
|
256
|
+
return Promise.resolve(`/marketplace`);
|
|
257
|
+
},
|
|
234
258
|
};
|
|
235
259
|
|
|
236
260
|
const mockTimeRangeContext = {
|
|
@@ -317,7 +341,7 @@ const RootRouteDebugger = () => {
|
|
|
317
341
|
*
|
|
318
342
|
* @param addTestRootContainer boolean to add test root container
|
|
319
343
|
* @param children children to be wrapped
|
|
320
|
-
* @returns
|
|
344
|
+
* @returns {ReactNode} children component wrapped in a test root container
|
|
321
345
|
*/
|
|
322
346
|
const TestRenderChildren = ({ addTestRootContainer, children }) => {
|
|
323
347
|
return addTestRootContainer ? (jsxRuntime.jsx("div", { className: "inline-block h-[1000px] w-[1024px] scale-[.99]", "data-testid": "testRoot", style: {
|
|
@@ -1004,7 +1028,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
1004
1028
|
* @param callback - The hook to test
|
|
1005
1029
|
* @param parentElement - Optional parent element wrapper
|
|
1006
1030
|
* @throws Error if the hook result is undefined or null (to ensure meaningful stability testing)
|
|
1007
|
-
* @returns true if the result is referentially stable after rerender (using Object.is()), false otherwise
|
|
1031
|
+
* @returns {boolean} true if the result is referentially stable after rerender (using Object.is()), false otherwise
|
|
1008
1032
|
*/
|
|
1009
1033
|
async verifyHookStability(callback, parentElement) {
|
|
1010
1034
|
const { result, rerender } = await this.renderHook(callback, parentElement);
|
package/index.esm.js
CHANGED
|
@@ -220,7 +220,7 @@ const mockNavigationContext = {
|
|
|
220
220
|
gotoAdmin: (url) => {
|
|
221
221
|
return Promise.resolve(true);
|
|
222
222
|
},
|
|
223
|
-
|
|
223
|
+
gotoAlerts: (url) => {
|
|
224
224
|
return Promise.resolve(true);
|
|
225
225
|
},
|
|
226
226
|
gotoMarketplace: () => {
|
|
@@ -229,6 +229,30 @@ const mockNavigationContext = {
|
|
|
229
229
|
reloadManager: () => {
|
|
230
230
|
return Promise.resolve(true);
|
|
231
231
|
},
|
|
232
|
+
getAssetHomeUrl: (assetId, options) => {
|
|
233
|
+
return Promise.resolve(`/assets/${assetId}/status`);
|
|
234
|
+
},
|
|
235
|
+
getSiteHomeUrl: (siteId, options) => {
|
|
236
|
+
return Promise.resolve(`/sites/${siteId}/overview`);
|
|
237
|
+
},
|
|
238
|
+
getCustomerHomeUrl: (customerId, options) => {
|
|
239
|
+
return Promise.resolve(customerId ? `/customers/${customerId}/info` : `/customers`);
|
|
240
|
+
},
|
|
241
|
+
getAppLibraryUrl: irisAppId => {
|
|
242
|
+
return Promise.resolve(`/administration/app-library`);
|
|
243
|
+
},
|
|
244
|
+
getFleetAppUrl: options => {
|
|
245
|
+
return Promise.resolve(`/fleet`);
|
|
246
|
+
},
|
|
247
|
+
getAdminUrl: url => {
|
|
248
|
+
return Promise.resolve(url ? `/administration${url}` : `/administration`);
|
|
249
|
+
},
|
|
250
|
+
getAlertsUrl: url => {
|
|
251
|
+
return Promise.resolve(url ? `/event-setup${url}` : `/event-setup`);
|
|
252
|
+
},
|
|
253
|
+
getMarketplaceUrl: options => {
|
|
254
|
+
return Promise.resolve(`/marketplace`);
|
|
255
|
+
},
|
|
232
256
|
};
|
|
233
257
|
|
|
234
258
|
const mockTimeRangeContext = {
|
|
@@ -315,7 +339,7 @@ const RootRouteDebugger = () => {
|
|
|
315
339
|
*
|
|
316
340
|
* @param addTestRootContainer boolean to add test root container
|
|
317
341
|
* @param children children to be wrapped
|
|
318
|
-
* @returns
|
|
342
|
+
* @returns {ReactNode} children component wrapped in a test root container
|
|
319
343
|
*/
|
|
320
344
|
const TestRenderChildren = ({ addTestRootContainer, children }) => {
|
|
321
345
|
return addTestRootContainer ? (jsx("div", { className: "inline-block h-[1000px] w-[1024px] scale-[.99]", "data-testid": "testRoot", style: {
|
|
@@ -1002,7 +1026,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
1002
1026
|
* @param callback - The hook to test
|
|
1003
1027
|
* @param parentElement - Optional parent element wrapper
|
|
1004
1028
|
* @throws Error if the hook result is undefined or null (to ensure meaningful stability testing)
|
|
1005
|
-
* @returns true if the result is referentially stable after rerender (using Object.is()), false otherwise
|
|
1029
|
+
* @returns {boolean} true if the result is referentially stable after rerender (using Object.is()), false otherwise
|
|
1006
1030
|
*/
|
|
1007
1031
|
async verifyHookStability(callback, parentElement) {
|
|
1008
1032
|
const { result, rerender } = await this.renderHook(callback, parentElement);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-contexts-test",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.37",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"@testing-library/react": "16.2.0",
|
|
12
12
|
"react": "19.0.0",
|
|
13
13
|
"graphql": "^16.10.0",
|
|
14
|
-
"@trackunit/react-core-contexts-api": "1.8.
|
|
15
|
-
"@trackunit/react-core-hooks": "1.7.
|
|
16
|
-
"@trackunit/shared-utils": "1.9.
|
|
17
|
-
"@trackunit/react-test-setup": "1.4.
|
|
14
|
+
"@trackunit/react-core-contexts-api": "1.8.34",
|
|
15
|
+
"@trackunit/react-core-hooks": "1.7.37",
|
|
16
|
+
"@trackunit/shared-utils": "1.9.31",
|
|
17
|
+
"@trackunit/react-test-setup": "1.4.31",
|
|
18
18
|
"@tanstack/react-router": "1.114.29",
|
|
19
19
|
"@tanstack/router-core": "1.114.29",
|
|
20
20
|
"es-toolkit": "^1.39.10"
|
|
@@ -415,7 +415,7 @@ export declare class TrackunitProvidersMockBuilder<T extends AnyRoute> {
|
|
|
415
415
|
* @param callback - The hook to test
|
|
416
416
|
* @param parentElement - Optional parent element wrapper
|
|
417
417
|
* @throws Error if the hook result is undefined or null (to ensure meaningful stability testing)
|
|
418
|
-
* @returns true if the result is referentially stable after rerender (using Object.is()), false otherwise
|
|
418
|
+
* @returns {boolean} true if the result is referentially stable after rerender (using Object.is()), false otherwise
|
|
419
419
|
*/
|
|
420
420
|
verifyHookStability<TProps, TResult>(callback: (props: TProps) => TResult, parentElement?: (children: ReactNode) => ReactElement): Promise<boolean>;
|
|
421
421
|
/**
|
|
@@ -26,7 +26,7 @@ export interface TestRenderChildrenProps {
|
|
|
26
26
|
*
|
|
27
27
|
* @param addTestRootContainer boolean to add test root container
|
|
28
28
|
* @param children children to be wrapped
|
|
29
|
-
* @returns
|
|
29
|
+
* @returns {ReactNode} children component wrapped in a test root container
|
|
30
30
|
*/
|
|
31
31
|
export declare const TestRenderChildren: ({ addTestRootContainer, children }: TestRenderChildrenProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
32
|
export interface RouterContainerProps<T extends AnyRoute = AnyRoute> {
|