Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/06-concepts/19-testing/02-the-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ To create an authenticated override, call `AuthenticationOverride.authentication

```dart
static AuthenticationOverride authenticationInfo(
int userId,
String userIdentifier,
Set<Scope> scopes, {
String? authId,
})
Expand All @@ -44,7 +44,7 @@ Pass these to `sessionBuilder.copyWith` to simulate different scenarios. Below f
```dart
withServerpod('Given AuthenticatedExample endpoint', (sessionBuilder, endpoints) {
// Corresponds to an actual user id
const int userId = 1234;
final userId = '550e8400-e29b-41d4-a716-446655440000';

group('when authenticated', () {
var authenticatedSessionBuilder = sessionBuilder.copyWith(
Expand Down Expand Up @@ -165,7 +165,7 @@ Future<void> concurrentTransactionCalls(
) async {
await Future.wait([
session.db.transaction((tx) => /*...*/),
// Will throw `InvalidConfigurationException` if `rollbackDatabase`
// Will throw `InvalidConfigurationException` if `rollbackDatabase`
// is not set to `RollbackDatabase.disabled` in `withServerpod`
session.db.transaction((tx) => /*...*/),
]);
Expand Down
8 changes: 4 additions & 4 deletions docs/06-concepts/19-testing/03-advanced-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ Then a test to verify this behavior can be written as below. Note the call to th

```dart
withServerpod('Given CommunicationExampleEndpoint', (sessionBuilder, endpoints) {
const int userId1 = 1;
const int userId2 = 2;
final userId1 = '550e8400-e29b-41d4-a716-446655440000';
final userId2 = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';

test(
'when calling postNumberToSharedStream and listenForNumbersOnSharedStream '
Expand All @@ -102,9 +102,9 @@ withServerpod('Given CommunicationExampleEndpoint', (sessionBuilder, endpoints)

var stream =
endpoints.testTools.listenForNumbersOnSharedStream(userSession1);
// Wait for `listenForNumbersOnSharedStream` to execute up to its
// Wait for `listenForNumbersOnSharedStream` to execute up to its
// `yield` statement before continuing
await flushEventQueue();
await flushEventQueue();

await endpoints.testTools.postNumberToSharedStream(userSession2, 111);
await endpoints.testTools.postNumberToSharedStream(userSession2, 222);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ To create an authenticated override, call `AuthenticationOverride.authentication

```dart
static AuthenticationOverride authenticationInfo(
int userId,
String userIdentifier,
Set<Scope> scopes, {
String? authId,
})
Expand All @@ -44,7 +44,7 @@ Pass these to `sessionBuilder.copyWith` to simulate different scenarios. Below f
```dart
withServerpod('Given AuthenticatedExample endpoint', (sessionBuilder, endpoints) {
// Corresponds to an actual user id
const int userId = 1234;
final userId = '550e8400-e29b-41d4-a716-446655440000';

group('when authenticated', () {
var authenticatedSessionBuilder = sessionBuilder.copyWith(
Expand Down Expand Up @@ -165,7 +165,7 @@ Future<void> concurrentTransactionCalls(
) async {
await Future.wait([
session.db.transaction((tx) => /*...*/),
// Will throw `InvalidConfigurationException` if `rollbackDatabase`
// Will throw `InvalidConfigurationException` if `rollbackDatabase`
// is not set to `RollbackDatabase.disabled` in `withServerpod`
session.db.transaction((tx) => /*...*/),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ Then a test to verify this behavior can be written as below. Note the call to th

```dart
withServerpod('Given CommunicationExampleEndpoint', (sessionBuilder, endpoints) {
const int userId1 = 1;
const int userId2 = 2;
final userId1 = '550e8400-e29b-41d4-a716-446655440000';
final userId2 = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';

test(
'when calling postNumberToSharedStream and listenForNumbersOnSharedStream '
Expand All @@ -102,9 +102,9 @@ withServerpod('Given CommunicationExampleEndpoint', (sessionBuilder, endpoints)

var stream =
endpoints.testTools.listenForNumbersOnSharedStream(userSession1);
// Wait for `listenForNumbersOnSharedStream` to execute up to its
// Wait for `listenForNumbersOnSharedStream` to execute up to its
// `yield` statement before continuing
await flushEventQueue();
await flushEventQueue();

await endpoints.testTools.postNumberToSharedStream(userSession2, 111);
await endpoints.testTools.postNumberToSharedStream(userSession2, 222);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ To create an authenticated override, call `AuthenticationOverride.authentication

```dart
static AuthenticationOverride authenticationInfo(
int userId,
String userIdentifier,
Set<Scope> scopes, {
String? authId,
})
Expand All @@ -44,7 +44,7 @@ Pass these to `sessionBuilder.copyWith` to simulate different scenarios. Below f
```dart
withServerpod('Given AuthenticatedExample endpoint', (sessionBuilder, endpoints) {
// Corresponds to an actual user id
const int userId = 1234;
final userId = '550e8400-e29b-41d4-a716-446655440000';

group('when authenticated', () {
var authenticatedSessionBuilder = sessionBuilder.copyWith(
Expand Down Expand Up @@ -165,7 +165,7 @@ Future<void> concurrentTransactionCalls(
) async {
await Future.wait([
session.db.transaction((tx) => /*...*/),
// Will throw `InvalidConfigurationException` if `rollbackDatabase`
// Will throw `InvalidConfigurationException` if `rollbackDatabase`
// is not set to `RollbackDatabase.disabled` in `withServerpod`
session.db.transaction((tx) => /*...*/),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ Then a test to verify this behavior can be written as below. Note the call to th

```dart
withServerpod('Given CommunicationExampleEndpoint', (sessionBuilder, endpoints) {
const int userId1 = 1;
const int userId2 = 2;
final userId1 = '550e8400-e29b-41d4-a716-446655440000';
final userId2 = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';

test(
'when calling postNumberToSharedStream and listenForNumbersOnSharedStream '
Expand All @@ -102,9 +102,9 @@ withServerpod('Given CommunicationExampleEndpoint', (sessionBuilder, endpoints)

var stream =
endpoints.testTools.listenForNumbersOnSharedStream(userSession1);
// Wait for `listenForNumbersOnSharedStream` to execute up to its
// Wait for `listenForNumbersOnSharedStream` to execute up to its
// `yield` statement before continuing
await flushEventQueue();
await flushEventQueue();

await endpoints.testTools.postNumberToSharedStream(userSession2, 111);
await endpoints.testTools.postNumberToSharedStream(userSession2, 222);
Expand Down