FurryChat/test/matrix_identifier_string_extension_test.dart

32 lines
1.2 KiB
Dart
Raw Normal View History

2020-09-19 17:21:33 +00:00
import 'package:flutter_test/flutter_test.dart';
2020-10-06 19:59:36 +00:00
import 'package:furrychat/utils/matrix_identifier_string_extension.dart';
2020-09-19 17:21:33 +00:00
void main() {
group('Matrix Identifier String Extension', () {
test('parseIdentifierIntoParts', () {
var res = '#alias:beep'.parseIdentifierIntoParts();
expect(res.roomIdOrAlias, '#alias:beep');
expect(res.eventId, null);
expect(res.queryString, null);
res = 'blha'.parseIdentifierIntoParts();
expect(res, null);
res = '#alias:beep/\$event'.parseIdentifierIntoParts();
expect(res.roomIdOrAlias, '#alias:beep');
expect(res.eventId, '\$event');
expect(res.queryString, null);
res = '#alias:beep?blubb'.parseIdentifierIntoParts();
expect(res.roomIdOrAlias, '#alias:beep');
expect(res.eventId, null);
expect(res.queryString, 'blubb');
res = '#alias:beep/\$event?blubb'.parseIdentifierIntoParts();
expect(res.roomIdOrAlias, '#alias:beep');
expect(res.eventId, '\$event');
expect(res.queryString, 'blubb');
res = '#/\$?:beep/\$event?blubb?b'.parseIdentifierIntoParts();
expect(res.roomIdOrAlias, '#/\$?:beep');
expect(res.eventId, '\$event');
expect(res.queryString, 'blubb?b');
});
});
}