-
Notifications
You must be signed in to change notification settings - Fork 39
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
basic tests #584
base: dev
Are you sure you want to change the base?
basic tests #584
Conversation
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.
Gonna make some ergonomic fixes and review our options for scaffolding tests
3951ed4
to
045878d
Compare
@@ -0,0 +1,27 @@ | |||
delete from metadatas where address = any(array [ |
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.
Normally unit tests involving databases are done in transaction that leave the db empty after each unit test but since we are only doing read operations seeding with a shared set of data works for our use case.
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.
Seconding this. I like the migration setup. It would be awesome to be able to define a migration per test in such a way that we could run up
and down
for a specific migration for each test, just to keep the db minimally populated with test-specific data.
This is a great start, though!
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.
looks awesome!
dotenv::from_filename(".env.dev").expect("Failed to load .env.dev"); | ||
dotenv::from_filename(".env").expect("Failed to load .env"); |
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.
should this also read from .env.local
?
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.
I chose not to as an attempt to enforce consistency in the test setup. Unsure if that will pay off, but if we need .env.local at some point I'll cave and add it.
@@ -0,0 +1,27 @@ | |||
delete from metadatas where address = any(array [ |
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.
Seconding this. I like the migration setup. It would be awesome to be able to define a migration per test in such a way that we could run up
and down
for a specific migration for each test, just to keep the db minimally populated with test-specific data.
This is a great start, though!
53f46fa
to
080e74f
Compare
080e74f
to
b1f2acd
Compare
This PR adds initial setup for running tests against DB queries. Right now it's primarily testing the collections queries. This will ensure that if fields required for deserialing
Nft
change, the build will fail.