feat: more easter eggs + version checking
This commit is contained in:
@@ -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',
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user