Skip to content

chore(test): add integration test for mongodb schema rule generation COMPASS-8890 #232

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

Merged
merged 3 commits into from
Feb 26, 2025

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Feb 20, 2025

COMPASS-8890

Adds a test that analyzes documents, creates a mongodb validation rule, tries inserting valid and invalid docs against it.

@@ -54,6 +54,7 @@
"reservoir": "^0.1.2"
},
"devDependencies": {
"@mongodb-js/compass-test-server": "^0.3.2",
Copy link
Member Author

@Anemy Anemy Feb 26, 2025

Choose a reason for hiding this comment

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

The mocha test setup and teardown when using mongodb-runner has some needed boiler plate to make it cleanup correctly. In Compass we do this in compass-test-server https://github.com/mongodb-js/compass/blob/main/packages/compass-test-server/src/index.ts .
I'm thinking it would be useful to have these helpers here in mongodb-schema.

Would it make sense to move the test-server-runner to devtools-shared? Or should we just copy over that mocha test code to here instead? Or we just include this import as-is and then we can do those changes down the line if we feel it's needed.

I'm likely going to merge this as is, as it's just for testing. Let me know what y'all think. I think if we get another place doing mongodb-runner test setup/teardown in mocha functions then let's move it out of compass.

@Anemy Anemy merged commit 262ffb8 into main Feb 26, 2025
20 checks passed
@Anemy Anemy deleted the COMPASS-8890 branch February 26, 2025 18:02
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