Depends on D15429
Create a standardized wrapper to make it easier to add and edit tests (and make sure they are all testing the same thing).
Differential D15431
[Cashtab] Create a standardized wrapper for test rendering bytesofman on Feb 13 2024, 01:13. Authored by
Details
Depends on D15429 Create a standardized wrapper to make it easier to add and edit tests (and make sure they are all testing the same thing). npm test
Diff Detail
Event TimelineComment Actions Build Bitcoin ABC Diffs / Diff Testing (cashtab-tests) failed.
Tail of the build log: > 15 | } | ^ 16 | 17 | async teardown() { 18 | await super.teardown(); at new CustomEnvironment (config/jest/custom-environment.js:15:35) FAIL src/slpv1/__tests__/index.test.js ● Test suite failed to run ReferenceError: structuredClone is not defined 13 | this.global.Uint8Array = Uint8Array; 14 | this.global.ArrayBuffer = ArrayBuffer; > 15 | } | ^ 16 | 17 | async teardown() { 18 | await super.teardown(); at new CustomEnvironment (config/jest/custom-environment.js:15:35) FAIL src/components/Etokens/__tests__/CreateTokenForm.test.js ● Test suite failed to run ReferenceError: structuredClone is not defined 13 | this.global.Uint8Array = Uint8Array; 14 | this.global.ArrayBuffer = ArrayBuffer; > 15 | } | ^ 16 | 17 | async teardown() { 18 | await super.teardown(); at new CustomEnvironment (config/jest/custom-environment.js:15:35) FAIL src/components/Home/__tests__/Home.test.js ● Test suite failed to run ReferenceError: structuredClone is not defined 13 | this.global.Uint8Array = Uint8Array; 14 | this.global.ArrayBuffer = ArrayBuffer; > 15 | } | ^ 16 | 17 | async teardown() { 18 | await super.teardown(); at new CustomEnvironment (config/jest/custom-environment.js:15:35) Test Suites: 31 failed, 31 total Tests: 0 total Snapshots: 0 total Time: 5.655 s Ran all test suites. Build cashtab-tests failed with exit code 1 Comment Actions Build Bitcoin ABC Diffs / Diff Testing (cashtab-tests) failed.
Tail of the build log: > 15 | } | ^ 16 | 17 | async teardown() { 18 | await super.teardown(); at new CustomEnvironment (config/jest/custom-environment.js:15:35) FAIL src/components/Home/__tests__/Home.test.js ● Test suite failed to run ReferenceError: structuredClone is not defined 13 | this.global.Uint8Array = Uint8Array; 14 | this.global.ArrayBuffer = ArrayBuffer; > 15 | } | ^ 16 | 17 | async teardown() { 18 | await super.teardown(); at new CustomEnvironment (config/jest/custom-environment.js:15:35) FAIL src/components/Common/__tests__/ScanQRCode.test.js ● Test suite failed to run ReferenceError: structuredClone is not defined 13 | this.global.Uint8Array = Uint8Array; 14 | this.global.ArrayBuffer = ArrayBuffer; > 15 | } | ^ 16 | 17 | async teardown() { 18 | await super.teardown(); at new CustomEnvironment (config/jest/custom-environment.js:15:35) FAIL src/components/Home/__tests__/Tx.test.js ● Test suite failed to run ReferenceError: structuredClone is not defined 13 | this.global.Uint8Array = Uint8Array; 14 | this.global.ArrayBuffer = ArrayBuffer; > 15 | } | ^ 16 | 17 | async teardown() { 18 | await super.teardown(); at new CustomEnvironment (config/jest/custom-environment.js:15:35) Test Suites: 31 failed, 31 total Tests: 0 total Snapshots: 0 total Time: 5.402 s Ran all test suites. Build cashtab-tests failed with exit code 1 Comment Actions Build Bitcoin ABC Diffs / Diff Testing (cashtab-tests) failed.
Tail of the build log: > 15 | } | ^ 16 | 17 | async teardown() { 18 | await super.teardown(); at new CustomEnvironment (config/jest/custom-environment.js:15:35) FAIL src/slpv1/__tests__/index.test.js ● Test suite failed to run ReferenceError: structuredClone is not defined 13 | this.global.Uint8Array = Uint8Array; 14 | this.global.ArrayBuffer = ArrayBuffer; > 15 | } | ^ 16 | 17 | async teardown() { 18 | await super.teardown(); at new CustomEnvironment (config/jest/custom-environment.js:15:35) FAIL src/components/Etokens/__tests__/CreateTokenForm.test.js ● Test suite failed to run ReferenceError: structuredClone is not defined 13 | this.global.Uint8Array = Uint8Array; 14 | this.global.ArrayBuffer = ArrayBuffer; > 15 | } | ^ 16 | 17 | async teardown() { 18 | await super.teardown(); at new CustomEnvironment (config/jest/custom-environment.js:15:35) FAIL src/components/Home/__tests__/Home.test.js ● Test suite failed to run ReferenceError: structuredClone is not defined 13 | this.global.Uint8Array = Uint8Array; 14 | this.global.ArrayBuffer = ArrayBuffer; > 15 | } | ^ 16 | 17 | async teardown() { 18 | await super.teardown(); at new CustomEnvironment (config/jest/custom-environment.js:15:35) Test Suites: 31 failed, 31 total Tests: 0 total Snapshots: 0 total Time: 5.431 s Ran all test suites. Build cashtab-tests failed with exit code 1 Comment Actions The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience. Comment Actions the toStrictEqual to toEqual change is I think related to the jsdom change from previous diff -- probably some issue with the exact storage type of localforage vs the objects used as mocks here. should be its own diff or better explained here
Comment Actions will standardize tests with the chronik mock first -- then try this diff throughout the app and see if there is any other weird behavior Comment Actions I'm able to repeat this strange phenomenon -- useStrictEqual fails bc data serializes to the same string when testing any element by routing the wrapped <App/> component without that element in scope. Same thing exhibited while refactoring the configure tests. This is a weird behavior. However, the goal of this diff is to make all integration tests
There appears to be a JSDOM impact when we get to an out-of-scope component through routing through App vs importing it directly. Well, we could have this same impact in the prod app. Since tests should be as close as possible to the prod app, and standardized, and toEqual is still an acceptable check for the prod app -- this improvement is still worth it. Comment Actions I don't really understand the issue with toStrictEqual, but it seems that toEqual is a good enough test for comparing these simple contact data structures. |