Skip to content

Commit 9082514

Browse files
committed
ui: Update userEvent to v14
1 parent a4c843b commit 9082514

File tree

90 files changed

+2675
-6957
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+2675
-6957
lines changed

.jest-setup.js

-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@ import 'core-js/stable';
44
import 'regenerator-runtime/runtime';
55

66
Enzyme.configure({ adapter: new Adapter() });
7-
8-
HTMLCanvasElement.prototype.getContext = () => {};

jest.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
testEnvironment: 'jsdom',
23
testMatch: ['**/?(*.)+(test).ts?(x)'],
34
transformIgnorePatterns: [
45
'/node_modules/(?!(vega-lite|@scality|pretty-bytes)/)',

jestSetupAfterEnv.tsx

+17
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ beforeEach(() => {
1010
queryClient.clear();
1111
});
1212

13+
// When testing that the upload api is effectively called
14+
// we are getting this error from MSW
15+
// error: TypeError [NetworkingError]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Blob
16+
// at new NodeError (node:internal/errors:372:5)
17+
// at Function.from (node:buffer:323:9)
18+
// at Object.concatChunkToBuffer (/Users/yanjincheng/Scality/zenko-ui/node_modules/@mswjs/interceptors/src/interceptors/ClientRequest/utils/concatChunkToBuffer.ts:6:20)
19+
// at NodeClientRequest.Object.<anonymous>.NodeClientRequest.getRequestBody (/Users/yanjincheng/Scality/zenko-ui/node_modules/@mswjs/interceptors/src/interceptors/ClientRequest/NodeClientRequest.ts:372:26)
20+
// at NodeClientRequest.Object.<anonymous>.NodeClientRequest.end (/Users/yanjincheng/Scality/zenko-ui/node_modules/@mswjs/interceptors/src/interceptors/ClientRequest/NodeClientRequest.ts:112:30)
21+
// We suspect this to be solved in msw 2.0.0, lets have a look when upgrading
22+
const originalBufferFrom = Buffer.from;
23+
Buffer.from = (potentialyBlob) => {
24+
if (potentialyBlob instanceof Blob) {
25+
return originalBufferFrom('test');
26+
}
27+
return originalBufferFrom(potentialyBlob);
28+
};
29+
1330
jest.mock('./src/react/next-architecture/ui/AuthProvider', () => {
1431
const INSTANCE_ID = '3d49e1f9-fa2f-40aa-b2d4-c7a8b04c6cde';
1532
return {

0 commit comments

Comments
 (0)