feat: more easter eggs + version checking

This commit is contained in:
2026-10-27 00:17:18 +01:00
parent 4d9ba67eb1
commit 1aee0541c4
14 changed files with 178 additions and 6 deletions
+39
View File
@@ -88,5 +88,44 @@ void main() {
throwsA(isA<UnauthorizedException>()),
);
});
test('sends the app version', () async {
late http.Request sent;
final client = KoolTapApiClient(
client: MockClient((request) async {
sent = request;
return http.Response('{}', 200);
}),
baseUrl: 'https://api.test',
appVersion: '1.4.0',
);
await client.sync(
token: 'token',
request: const SyncRequest(deviceId: 'device', openTabs: []),
);
expect(sent.headers['X-App-Version'], '1.4.0');
});
test('treats a 426 as an app that must be updated', () async {
final client = _clientReturning(
_error(426, 'app_update_required', 'Update the app to version 1.4.0'),
);
await expectLater(
client.sync(
token: 'token',
request: const SyncRequest(deviceId: 'device', openTabs: []),
),
throwsA(
isA<UpdateRequiredException>().having(
(e) => e.message,
'message',
'Update the app to version 1.4.0',
),
),
);
});
});
}