48 lines
1.3 KiB
Dart
48 lines
1.3 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/features/updates/app_updates.dart';
|
|
|
|
void main() {
|
|
test('builds live on the server\'s own web origin', () {
|
|
expect(
|
|
updatesBaseFor(
|
|
Uri.parse('wss://host.ts.net:8443/connect'),
|
|
configured: '',
|
|
).toString(),
|
|
'https://host.ts.net:8443/updates/',
|
|
);
|
|
expect(
|
|
updatesBaseFor(
|
|
Uri.parse('ws://192.168.1.5:8082/connect'),
|
|
configured: '',
|
|
).toString(),
|
|
'http://192.168.1.5:8082/updates/',
|
|
);
|
|
});
|
|
|
|
test('a build can name another update feed', () {
|
|
expect(
|
|
updatesBaseFor(
|
|
Uri.parse('wss://host.ts.net:8443/connect'),
|
|
configured: 'https://host.ts.net:8096/updates',
|
|
).toString(),
|
|
'https://host.ts.net:8096/updates/',
|
|
);
|
|
});
|
|
|
|
test('version.json names the build and its APK', () {
|
|
final base = Uri.parse('https://host.ts.net:8096/updates/');
|
|
final update = AppUpdate.parse(
|
|
'{"versionCode": 29960000, "versionName": "0.1.29960000", '
|
|
'"apk": "pipelines.apk", "notes": "fixes"}',
|
|
base,
|
|
)!;
|
|
expect(update.versionCode, 29960000);
|
|
expect(
|
|
update.apk.toString(),
|
|
'https://host.ts.net:8096/updates/pipelines.apk',
|
|
);
|
|
expect(AppUpdate.parse('{}', base), isNull);
|
|
expect(AppUpdate.parse('not json', base), isNull);
|
|
});
|
|
}
|