New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Jest] Migrate src/ui/control/attribution_control.test.ts
#543
Conversation
Bundle size report: Size Change: 0 B
ℹ️ View DetailsNo major changes |
Please add the removal of the "old" file to #458, also |
…o 20211020__attributioncontrol
The delay is an optional parameter and is set 0 by default (https://developer.mozilla.org/en-US/docs/Web/API/setTimeout). But you are right. I added the paramater, so it is more correct. |
jest.config.cjs
Outdated
@@ -15,4 +15,5 @@ module.exports = { | |||
transformIgnorePatterns: [ | |||
], | |||
setupFiles: ["jest-canvas-mock"], | |||
setupFilesAfterEnv: ["./setup.js"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jest_setup? mock_setup? test_setup? I think setup.is too general...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about it more, why not wrap the functionality in this file and move it to util.ts file and simply call it in beforeEach
in the relevant tests? wouldn't it be more clear when looking at the test what the test is doing? It will cause a bit more code duplication, but I think it's OK...
…o 20211020__attributioncontrol
I have now removed I am just trying to understand this more clearly. I thought the line |
I don't think it is related to sinon, I think it is related to node and the fact that the code runs in jsdom. |
Special things here:
test/util/index.js
. As this file is used also withtape
I did not want to change it. I decide to copy it.cp test/util/index.js src/util/test/util.ts
.setup.js
instead of the stubloader. (https://jestjs.io/docs/configuration#setupfilesafterenv-array). Then I copied the needed stuff form stubloader,.If saw this error