Existing tests here are not particularly helpful...expecting onClick to have been called on a click.
Update so we test the actual behavior we want to see -- user clicks, a div is displayed that has the text content of the address.
Differential D15480
[Cashtab] Bring QRCode tests in line with rest of react testing lib tests Authored by bytesofman on Feb 18 2024, 15:10.
Details
Existing tests here are not particularly helpful...expecting onClick to have been called on a click. Update so we test the actual behavior we want to see -- user clicks, a div is displayed that has the text content of the address. npm test
Diff Detail
Event TimelineComment Actions Build Bitcoin ABC Diffs / Diff Testing (cashtab-tests) failed.
Failed tests logs: ====== CashTab Unit Tests: <Receive /> Renders the Receive screen correctly ======
Error: expect(received).toHaveStyle()
received value must be an HTMLElement or an SVGElement.
Received has value: null
at __EXTERNAL_MATCHER_TRAP__ (/work/cashtab/node_modules/expect/build/index.js:325:30)
at Object.throwingMatcher [as toHaveStyle] (/work/cashtab/node_modules/expect/build/index.js:326:15)
at Object.toHaveStyle (/work/cashtab/src/components/Receive/__tests__/Receive.test.js:90:56)
at Promise.then.completed (/work/cashtab/node_modules/jest-circus/build/utils.js:298:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (/work/cashtab/node_modules/jest-circus/build/utils.js:231:10)
at _callCircusTest (/work/cashtab/node_modules/jest-circus/build/run.js:316:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _runTest (/work/cashtab/node_modules/jest-circus/build/run.js:252:3)
at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:126:9)
at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:121:9)
at run (/work/cashtab/node_modules/jest-circus/build/run.js:71:3)
at runAndTransformResultsToJestFormat (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
at jestAdapter (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
at runTestInternal (/work/cashtab/node_modules/jest-runner/build/runTest.js:367:16)
at runTest (/work/cashtab/node_modules/jest-runner/build/runTest.js:444:34)
at Object.worker (/work/cashtab/node_modules/jest-runner/build/testWorker.js:106:12)
====== CashTab Unit Tests: <Receive /> Clicking the QR code copy pastes address to clipboard ======
Error: expect(received).toHaveStyle()
received value must be an HTMLElement or an SVGElement.
Received has value: null
at __EXTERNAL_MATCHER_TRAP__ (/work/cashtab/node_modules/expect/build/index.js:325:30)
at Object.throwingMatcher [as toHaveStyle] (/work/cashtab/node_modules/expect/build/index.js:326:15)
at Object.toHaveStyle (/work/cashtab/src/components/Receive/__tests__/Receive.test.js:191:56)Each failure log is accessible here: Comment Actions Build Bitcoin ABC Diffs / Diff Testing (cashtab-tests) failed.
Failed tests logs: ====== CashTab Unit Tests: <Receive /> Renders the Receive screen correctly ======
Error: expect(received).toHaveStyle()
received value must be an HTMLElement or an SVGElement.
Received has value: null
at __EXTERNAL_MATCHER_TRAP__ (/work/cashtab/node_modules/expect/build/index.js:325:30)
at Object.throwingMatcher [as toHaveStyle] (/work/cashtab/node_modules/expect/build/index.js:326:15)
at Object.toHaveStyle (/work/cashtab/src/components/Receive/__tests__/Receive.test.js:90:56)
at Promise.then.completed (/work/cashtab/node_modules/jest-circus/build/utils.js:298:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (/work/cashtab/node_modules/jest-circus/build/utils.js:231:10)
at _callCircusTest (/work/cashtab/node_modules/jest-circus/build/run.js:316:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _runTest (/work/cashtab/node_modules/jest-circus/build/run.js:252:3)
at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:126:9)
at _runTestsForDescribeBlock (/work/cashtab/node_modules/jest-circus/build/run.js:121:9)
at run (/work/cashtab/node_modules/jest-circus/build/run.js:71:3)
at runAndTransformResultsToJestFormat (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
at jestAdapter (/work/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
at runTestInternal (/work/cashtab/node_modules/jest-runner/build/runTest.js:367:16)
at runTest (/work/cashtab/node_modules/jest-runner/build/runTest.js:444:34)
at Object.worker (/work/cashtab/node_modules/jest-runner/build/testWorker.js:106:12)
====== CashTab Unit Tests: <Receive /> Clicking the QR code copy pastes address to clipboard ======
Error: expect(received).toHaveStyle()
received value must be an HTMLElement or an SVGElement.
Received has value: null
at __EXTERNAL_MATCHER_TRAP__ (/work/cashtab/node_modules/expect/build/index.js:325:30)
at Object.throwingMatcher [as toHaveStyle] (/work/cashtab/node_modules/expect/build/index.js:326:15)
at Object.toHaveStyle (/work/cashtab/src/components/Receive/__tests__/Receive.test.js:191:56)Each failure log is accessible here:
| ||||||||||||||||||||