You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.
Testing with Adonis is amazingly simple, however, the docs are not really explaining much about its capabilities. The only reason I know of them is because I have experience working with Laravel and watched Laracasts.
But testing Adonis shouldn't require prior knowledge in a framework from a different language that is only really taught in a course behind a paywall.
Only because of my prior knowledge I was searching everywhere in the docs and code for things like using migrations within the tests (eventually found it in vowfile.js commented out) or the databaseTransactions trait (eventually found under "Fakes" in the documentation?).
I know that not every project requires lucid, but I still believe that the docs could be improved by shuffling around some of the sections and also by making use of "Recipes".
Idea
Introduce a new section under "Testing" called "Database"
This section should explain the following topics
The fact that you don't have to mock out the database layer
The usage of a sqlite database for tests, even though you actually use something else
How to make use of migrations for testing (vowfile.js)
Move "DatabaseTransactions" trait section from "Fakes" to here
Link to "Factories" section and quickly describe how they can simplify your tests
Link to new recipe that describes a simple example that gives people creative ideas for their own test scenarios.
Example of recipe (only including test file for now):
// ...trait('DatabaseTransactions')test('updates user name',async({ assert, client })=>{constuser=awaitFactory.model('App/Models/User').create()constresponse=awaitclient.put('/user/name').send({name: 'new name'}).end()awaituser.reload()assert.equal(user.name,'new name')})
The text was updated successfully, but these errors were encountered:
Testing with Adonis is amazingly simple, however, the docs are not really explaining much about its capabilities. The only reason I know of them is because I have experience working with Laravel and watched Laracasts.
But testing Adonis shouldn't require prior knowledge in a framework from a different language that is only really taught in a course behind a paywall.
Only because of my prior knowledge I was searching everywhere in the docs and code for things like using migrations within the tests (eventually found it in vowfile.js commented out) or the databaseTransactions trait (eventually found under "Fakes" in the documentation?).
I know that not every project requires lucid, but I still believe that the docs could be improved by shuffling around some of the sections and also by making use of "Recipes".
Idea
Introduce a new section under "Testing" called "Database"
This section should explain the following topics
Example of recipe (only including test file for now):
The text was updated successfully, but these errors were encountered: