2020-06-05 16:17:08 +02:00
|
|
|
import 'package:test/test.dart';
|
|
|
|
import 'package:youtube_explode_dart/youtube_explode_dart.dart';
|
|
|
|
|
|
|
|
void main() {
|
2020-10-17 22:09:52 +02:00
|
|
|
group('These are valid usernames', () {
|
2021-03-11 14:20:10 +01:00
|
|
|
for (final val in {'TheTyrrr', 'KannibalenRecords', 'JClayton1994'}) {
|
2020-10-17 22:09:52 +02:00
|
|
|
test('Username - $val', () {
|
|
|
|
expect(Username(val).value, val);
|
2020-06-05 16:17:08 +02:00
|
|
|
});
|
2020-10-17 22:09:52 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
group('These are valid username urls', () {
|
2021-03-11 14:20:10 +01:00
|
|
|
for (final val in {
|
2020-10-17 22:09:52 +02:00
|
|
|
['youtube.com/user/ProZD', 'ProZD'],
|
|
|
|
['youtube.com/user/TheTyrrr', 'TheTyrrr'],
|
|
|
|
}) {
|
|
|
|
test('UsernameURL - $val', () {
|
|
|
|
expect(Username(val[0]).value, val[1]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
group('These are invalid usernames', () {
|
2021-03-11 14:20:10 +01:00
|
|
|
for (final val in {
|
2020-10-17 22:09:52 +02:00
|
|
|
'The_Tyrrr',
|
|
|
|
'0123456789ABCDEFGHIJK',
|
|
|
|
'A1B2C3-',
|
|
|
|
'=0123456789ABCDEF'
|
|
|
|
}) {
|
|
|
|
test('Username - $val', () {
|
|
|
|
expect(() => Username(val), throwsArgumentError);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
group('These are not valid username urls', () {
|
2021-03-11 14:20:10 +01:00
|
|
|
for (final val in {
|
2020-10-17 22:09:52 +02:00
|
|
|
'youtube.com/user/P_roZD',
|
|
|
|
'example.com/user/ProZD',
|
|
|
|
}) {
|
|
|
|
test('UsernameURL - $val', () {
|
|
|
|
expect(() => Username(val), throwsArgumentError);
|
2020-06-05 16:17:08 +02:00
|
|
|
});
|
2020-10-17 22:09:52 +02:00
|
|
|
}
|
2020-06-05 16:17:08 +02:00
|
|
|
});
|
|
|
|
}
|