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
Copy file name to clipboardExpand all lines: README.md
+36-20Lines changed: 36 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -148,40 +148,56 @@ This works across the entire test suite.
148
148
149
149
Note that if unique parameters are passed to the `beforeTemplateIsBaked` (`null` in the above example), separate databases will still be created.
150
150
151
-
### "Nested" `beforeTemplateIsBaked` calls
151
+
### Manual template creation
152
152
153
-
In some cases, if you do extensive setup in your `beforeTemplateIsBaked` hook, you might want to obtain a separate, additional database within it if your application uses several databases for different purposes. This is possible by using the passed `beforeTemplateIsBaked` to your hook callback:
153
+
In some cases, if you do extensive setup in your `beforeTemplateIsBaked` hook, you might want to obtain a separate, additional database within it if your application uses several databases for different purposes. This is possible by using the `manuallyBuildAdditionalTemplate()` function passed to your hook callback:
awaitfooDatabase.pool.query(`SELECT * FROM "foo"`)
196
+
})
197
+
})
182
198
```
183
199
184
-
Be very careful when using this to avoid infinite loops.
200
+
Although it's not shown in the above example, because of `ava-postgres`'s automatic de-duping by parameter combinations, any returned template name is "linked" to the parameters passed to the `getTestDatabase()` function.
0 commit comments