-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Add DatabaseTestUtils #988
Conversation
tests will fail cause of the last two commits since we dont have TestUtils exported from |
Yeah, we can export it from
We can use the container
Yeah, can be lazily resolved as someone uses one of the methods from the |
Should be all good. Let me just know if we keep |
Looks good. We will have to create a new doc under the testing group, inside the AdonisJS documentation covering the usage of these hooks |
Changes
Add a DatabaseTestUtils class. Works as before.
testUtils.db().migrate()
testUtils.db().truncate()
testUtils.db().seed()
,We can also pass a custom connectionName like
testUtils.db('secondary').seed()
Also, let me know if we should not keep it, but though it would be cool to include a
testUtils.db().withGlobalTransaction()
method that can be used like this :So every test in this group will be wrapped a transaction that will be reverted at the end of the test