Skip to content
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

[no-issue]: Convert database tests to jest #4188

Merged
merged 3 commits into from
Sep 23, 2022
Merged

Conversation

kael89
Copy link
Collaborator

@kael89 kael89 commented Sep 23, 2022

2 more packages (central-server, web-config-server) and then mocha can go! 🎉

Most of the job was done using a community codemod

@@ -101,17 +99,5 @@ describe('DataElement', () => {
);
});
});

it('should remove valid fields when empty', () => {
Copy link
Collaborator Author

@kael89 kael89 Sep 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a duplicate test case wtih a misleading name

@kael89 kael89 force-pushed the convert-database-tests-to-jest branch from e744b7a to edf3d4e Compare September 23, 2022 02:47
Copy link
Member

@edmofro edmofro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked through and all looks good to me! Great that you caught a few things like that dupe test, some unneeded awaits, and even the language used to describe each test case.

Thanks for swooping in with your tech debt cleaning super powers, Open Source Community 😁

@edmofro edmofro enabled auto-merge (squash) September 23, 2022 02:48
runSql: (query, replacementParams) => ({ query, replacementParams }),
};

describe('migrationUtilities', () => {
Copy link
Collaborator Author

@kael89 kael89 Sep 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restructured this file a bit to make it less verbose

@edmofro
Copy link
Member

edmofro commented Sep 23, 2022

Have enabled auto-merge, will be committed to dev as soon as CI/CD checks have passed.

@kael89
Copy link
Collaborator Author

kael89 commented Sep 23, 2022

Have enabled auto-merge, will be committed to dev as soon as CI/CD checks have passed.

Ah nice, that's a handy feature! A few dev scripts have been touched because of the test folder update. I guess that if anything has been messed up the CI/CD will tell :-)

// responseDescriptionFields,
// )}`;

expect(surveyResponse).toHaveProperty('outdated', expected);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a 3rd parameter (for a custom message) is not only unsupported by jest, but it causes toHaveProperty to always pass! 😨

Interestingly this is not the case with toBe, which fails as expected. I double-checked that the only instance where custom messages are still used in this package is in AnalyticsRefresher.test.js, for .toBe assertions.

@edmofro edmofro merged commit 9139e02 into dev Sep 23, 2022
@edmofro edmofro deleted the convert-database-tests-to-jest branch September 23, 2022 03:57
@edmofro edmofro mentioned this pull request Sep 29, 2022
@avaek avaek mentioned this pull request Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants