@trackunit/react-test-setup 1.4.10 → 1.4.12
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 +1 -28
- package/index.esm.js +2 -28
- package/package.json +1 -1
- package/src/index.d.ts +0 -1
- package/src/setupReactTablePagination.d.ts +0 -7
package/index.cjs.js
CHANGED
|
@@ -528,6 +528,7 @@ const setupTanstackReactVirtual = () => {
|
|
|
528
528
|
resetAfterItem: () => { },
|
|
529
529
|
scrollTo: () => { },
|
|
530
530
|
measure: () => { },
|
|
531
|
+
measureElement: () => 42,
|
|
531
532
|
}),
|
|
532
533
|
}));
|
|
533
534
|
};
|
|
@@ -854,33 +855,6 @@ const setupDefaultMocks = (options = {}) => {
|
|
|
854
855
|
setupTranslations();
|
|
855
856
|
};
|
|
856
857
|
|
|
857
|
-
/**
|
|
858
|
-
* Sets up a mocked implementation of the `useInfiniteScroll` hook from
|
|
859
|
-
* `@trackunit/react-table-pagination` for testing purposes.
|
|
860
|
-
*
|
|
861
|
-
* @param {number} [count] - The number of virtual items to generate for the mocked implementation.
|
|
862
|
-
*/
|
|
863
|
-
const setupReactTablePagination = (count) => {
|
|
864
|
-
jest.mock("@trackunit/react-table-pagination", () => ({
|
|
865
|
-
...jest.requireActual("@trackunit/react-table-pagination"),
|
|
866
|
-
useInfiniteScroll: jest.fn(() => ({
|
|
867
|
-
getTotalSize: jest.fn(() => 100),
|
|
868
|
-
getVirtualItems: () => {
|
|
869
|
-
const result = [];
|
|
870
|
-
for (let i = 0; i < (count || 4); i++) {
|
|
871
|
-
result.push({ index: i, start: i * 40, key: i, size: 40 });
|
|
872
|
-
}
|
|
873
|
-
return result;
|
|
874
|
-
},
|
|
875
|
-
measureElement: jest.fn(),
|
|
876
|
-
scrollToOffset: jest.fn(),
|
|
877
|
-
scrollToIndex: jest.fn(),
|
|
878
|
-
scrollOffset: 0,
|
|
879
|
-
isScrolling: false,
|
|
880
|
-
})),
|
|
881
|
-
}));
|
|
882
|
-
};
|
|
883
|
-
|
|
884
858
|
/**
|
|
885
859
|
* Mocks the @tanstack/router library for testing environments.
|
|
886
860
|
*
|
|
@@ -911,7 +885,6 @@ exports.setupGoogleMaps = setupGoogleMaps;
|
|
|
911
885
|
exports.setupHelmetMock = setupHelmetMock;
|
|
912
886
|
exports.setupIntersectionObserver = setupIntersectionObserver;
|
|
913
887
|
exports.setupMatchMediaMock = setupMatchMediaMock;
|
|
914
|
-
exports.setupReactTablePagination = setupReactTablePagination;
|
|
915
888
|
exports.setupReactTestingLibrary = setupReactTestingLibrary;
|
|
916
889
|
exports.setupReactVirtualizedAutoSizer = setupReactVirtualizedAutoSizer;
|
|
917
890
|
exports.setupResizeObserver = setupResizeObserver;
|
package/index.esm.js
CHANGED
|
@@ -507,6 +507,7 @@ const setupTanstackReactVirtual = () => {
|
|
|
507
507
|
resetAfterItem: () => { },
|
|
508
508
|
scrollTo: () => { },
|
|
509
509
|
measure: () => { },
|
|
510
|
+
measureElement: () => 42,
|
|
510
511
|
}),
|
|
511
512
|
}));
|
|
512
513
|
};
|
|
@@ -833,33 +834,6 @@ const setupDefaultMocks = (options = {}) => {
|
|
|
833
834
|
setupTranslations();
|
|
834
835
|
};
|
|
835
836
|
|
|
836
|
-
/**
|
|
837
|
-
* Sets up a mocked implementation of the `useInfiniteScroll` hook from
|
|
838
|
-
* `@trackunit/react-table-pagination` for testing purposes.
|
|
839
|
-
*
|
|
840
|
-
* @param {number} [count] - The number of virtual items to generate for the mocked implementation.
|
|
841
|
-
*/
|
|
842
|
-
const setupReactTablePagination = (count) => {
|
|
843
|
-
jest.mock("@trackunit/react-table-pagination", () => ({
|
|
844
|
-
...jest.requireActual("@trackunit/react-table-pagination"),
|
|
845
|
-
useInfiniteScroll: jest.fn(() => ({
|
|
846
|
-
getTotalSize: jest.fn(() => 100),
|
|
847
|
-
getVirtualItems: () => {
|
|
848
|
-
const result = [];
|
|
849
|
-
for (let i = 0; i < (count || 4); i++) {
|
|
850
|
-
result.push({ index: i, start: i * 40, key: i, size: 40 });
|
|
851
|
-
}
|
|
852
|
-
return result;
|
|
853
|
-
},
|
|
854
|
-
measureElement: jest.fn(),
|
|
855
|
-
scrollToOffset: jest.fn(),
|
|
856
|
-
scrollToIndex: jest.fn(),
|
|
857
|
-
scrollOffset: 0,
|
|
858
|
-
isScrolling: false,
|
|
859
|
-
})),
|
|
860
|
-
}));
|
|
861
|
-
};
|
|
862
|
-
|
|
863
837
|
/**
|
|
864
838
|
* Mocks the @tanstack/router library for testing environments.
|
|
865
839
|
*
|
|
@@ -881,4 +855,4 @@ const setupTanstackReactRouter = () => {
|
|
|
881
855
|
}));
|
|
882
856
|
};
|
|
883
857
|
|
|
884
|
-
export { setupAllMocks, setupBasicMocks, setupCanvasMock, setupDefaultMocks, setupFailOnConsole, setupGoogleMaps, setupHelmetMock, setupIntersectionObserver, setupMatchMediaMock,
|
|
858
|
+
export { setupAllMocks, setupBasicMocks, setupCanvasMock, setupDefaultMocks, setupFailOnConsole, setupGoogleMaps, setupHelmetMock, setupIntersectionObserver, setupMatchMediaMock, setupReactTestingLibrary, setupReactVirtualizedAutoSizer, setupResizeObserver, setupTanstackReactRouter, setupTanstackReactVirtual, setupTimeAndLanguage, setupTimeZone, setupTranslations, setupWebStreams };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-test-setup",
|
|
3
3
|
"description": "Test setup utilities for React applications",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.12",
|
|
5
5
|
"repository": "https://github.com/Trackunit/manager",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
7
7
|
"engines": {
|
package/src/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export * from "./setupGoogleMaps";
|
|
|
7
7
|
export * from "./setupHelmetMock";
|
|
8
8
|
export * from "./setupIntersectionObserver";
|
|
9
9
|
export * from "./setupMatchMediaMock";
|
|
10
|
-
export * from "./setupReactTablePagination";
|
|
11
10
|
export * from "./setupReactTestingLibrary";
|
|
12
11
|
export * from "./setupReactVirtualizedAutoSizer";
|
|
13
12
|
export * from "./setupResizeObserver";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sets up a mocked implementation of the `useInfiniteScroll` hook from
|
|
3
|
-
* `@trackunit/react-table-pagination` for testing purposes.
|
|
4
|
-
*
|
|
5
|
-
* @param {number} [count] - The number of virtual items to generate for the mocked implementation.
|
|
6
|
-
*/
|
|
7
|
-
export declare const setupReactTablePagination: (count?: number) => void;
|