33 lines
945 B
Dart
33 lines
945 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:marianum_mobile/push/push_message_handler.dart';
|
|
|
|
void main() {
|
|
group('classifyPush', () {
|
|
test('nextcloud push has subject + signature', () {
|
|
expect(
|
|
classifyPush({'subject': 'enc', 'signature': 'sig', 'type': 'chat'}),
|
|
PushKind.nextcloud,
|
|
);
|
|
});
|
|
|
|
test('connect push identified by source', () {
|
|
expect(
|
|
classifyPush({'source': 'connect', 'title': 'Hi', 'body': 'There'}),
|
|
PushKind.connect,
|
|
);
|
|
});
|
|
|
|
test('subject without signature is not a nextcloud push', () {
|
|
expect(classifyPush({'subject': 'enc'}), PushKind.unknown);
|
|
});
|
|
|
|
test('empty subject/signature is unknown', () {
|
|
expect(classifyPush({'subject': '', 'signature': ''}), PushKind.unknown);
|
|
});
|
|
|
|
test('unrelated payload is unknown', () {
|
|
expect(classifyPush({'foo': 'bar'}), PushKind.unknown);
|
|
});
|
|
});
|
|
}
|