|
4 | 4 |
|
5 | 5 | The `withServerpod` helper provides a `sessionBuilder` that helps with setting up different scenarios for tests. To modify the session builder's properties, call its `copyWith` method. It takes the following named parameters:
|
6 | 6 |
|
7 |
| -|Property|Type|Default|Description| |
8 |
| -|:-----|:-----|:---:|:-----| |
9 |
| -|`authentication`|`AuthenticationOverride?`|`AuthenticationOverride.unauthenticated()`|See section [Setting authenticated state](#setting-authenticated-state).| |
10 |
| -|`enableLogging`|`bool?`|`false`|Wether logging is turned on for the session.| |
| 7 | +|Property|Description|Default| |
| 8 | +|:---|:---|:---:| |
| 9 | +|`authentication`|See section [Setting authenticated state](#setting-authenticated-state).|`AuthenticationOverride.unauthenticated()`| |
| 10 | +|`enableLogging`|Whether logging is turned on for the session.|`false`| |
11 | 11 |
|
12 | 12 | The `copyWith` method creates a new unique session builder with the provided properties. This can then be used in endpoint calls (see section [Setting authenticated state](#setting-authenticated-state) for an example).
|
13 | 13 |
|
@@ -125,13 +125,15 @@ withServerpod(
|
125 | 125 |
|
126 | 126 | The following optional configuration options are available to pass as a second argument to `withServerpod`:
|
127 | 127 |
|
128 |
| -|Property|Type|Default| |
| 128 | +|Property|Description|Default| |
129 | 129 | |:-----|:-----|:---:|
|
130 |
| -|`rollbackDatabase`|`RollbackDatabase?`|`RollbackDatabase.afterEach`| |
131 |
| -|`runMode`|`String?`|`ServerpodRunmode.test`| |
132 |
| -|`enableSessionLogging`|`bool?`|`false`| |
133 |
| -|`applyMigrations`|`bool?`|`true`| |
134 |
| -|`testGroupTagsOverride`|`List<String>?`|`null`| |
| 130 | +|`applyMigrations`|Whether pending migrations should be applied when starting Serverpod.|`true`| |
| 131 | +|`enableSessionLogging`|Whether session logging should be enabled.|`false`| |
| 132 | +|`rollbackDatabase`|Options for when to rollback the database during the test lifecycle (or disable it). See detailed description [here](#rollback-database-configuration).|`RollbackDatabase.afterEach`| |
| 133 | +|`runMode`|The run mode that Serverpod should be running in.|`ServerpodRunmode.test`| |
| 134 | +|`serverpodLoggingMode`|The logging mode used when creating Serverpod.|`ServerpodLoggingMode.normal`| |
| 135 | +|`serverpodStartTimeout`|The timeout to use when starting Serverpod, which connects to the database among other things. Defaults to `Duration(seconds: 30)`.|`Duration(seconds: 30)`| |
| 136 | +|`testGroupTagsOverride`|By default Serverpod test tools tags the `withServerpod` test group with `"integration"`. This is to provide a simple way to only run unit or integration tests. This property allows this tag to be overridden to something else. Defaults to `['integration']`.|`['integration']`| |
135 | 137 |
|
136 | 138 | ### `rollbackDatabase` {#rollback-database-configuration}
|
137 | 139 |
|
@@ -224,22 +226,6 @@ await transactionFuture;
|
224 | 226 |
|
225 | 227 | In production, the transaction call will throw if any database exception happened during its execution, _even_ if the exception was first caught inside the transaction. However, in the test tools this will not throw an exception due to how the nested transactions are emulated. Quelling exceptions like this is not best practise, but if the code under test does this setting `rollbackDatabase` to `RollbackDatabse.disabled` will ensure the code behaves like in production.
|
226 | 228 |
|
227 |
| -### `runMode` |
228 |
| - |
229 |
| -The run mode that Serverpod should be running in. Defaults to `test`. |
230 |
| - |
231 |
| -### `enableSessionLogging` |
232 |
| - |
233 |
| -Wether session logging should be enabled. Defaults to `false`. |
234 |
| - |
235 |
| -### `applyMigrations` |
236 |
| - |
237 |
| -Wether pending migrations should be applied when starting Serverpod. Defaults to `true`. |
238 |
| - |
239 |
| -### `testGroupTagsOverride` {#test-group-tags-override-configuration} |
240 |
| - |
241 |
| -By default Serverpod test tools tags the `withServerpod` test group with `"integration"`. This is to provide a simple way to only run unit or integration tests. This property allows this tag to be overridden to something else. Defaults to `null` (i.e. no override). |
242 |
| - |
243 | 229 | ## Test exceptions
|
244 | 230 |
|
245 | 231 | The following exceptions are exported from the generated test tools file and can be thrown by the test tools in various scenarios, see below.
|
|
0 commit comments