Skip to content

Commit 0c9bf6f

Browse files
committed
api test: Fix a test to use Account.copyWith when it means that
The "auth headers sent by default" test below assumes that the request is made with the email and API key of `eg.selfAccount`. It happens to be true that `eg.account(user: eg.selfUser, …)` will get that email, but that's a bit of an accident about how eg.account works and what data is on eg.selfUser. Instead of `eg.account`, use `eg.selfAccount.copyWith`, to make the intention more explicit.
1 parent 8b564e4 commit 0c9bf6f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

test/api/core_test.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ void main() {
2424
Future<http.BaseRequest> makeRequest(String realmUrl, String requestUrl, {
2525
bool? useAuth,
2626
}) {
27-
final account = eg.account(user: eg.selfUser, apiKey: eg.selfAccount.apiKey,
28-
realmUrl: Uri.parse(realmUrl));
27+
final account = eg.selfAccount.copyWith(realmUrl: Uri.parse(realmUrl));
2928
return FakeApiConnection.with_(account: account, (connection) async {
3029
connection.prepare(json: {});
3130
final request = http.Request('GET', Uri.parse(requestUrl));

0 commit comments

Comments
 (0)