2021-05-14 10:34:09 +00:00
|
|
|
import 'package:angel3_framework/angel3_framework.dart';
|
2019-04-10 23:05:53 +00:00
|
|
|
import 'package:test/test.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
test('null', () {
|
2021-05-11 12:48:22 +00:00
|
|
|
//expect(Service.parseId('null'), null);
|
|
|
|
//expect(Service.parseId(null), null);
|
|
|
|
|
|
|
|
expect(() => Service.parseId('null'), throwsArgumentError);
|
|
|
|
expect(() => Service.parseId(null), throwsArgumentError);
|
2019-04-10 23:05:53 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test('String', () {
|
|
|
|
expect(Service.parseId('23'), '23');
|
|
|
|
});
|
|
|
|
|
|
|
|
test('int', () {
|
|
|
|
expect(Service.parseId<int>('23'), 23);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('double', () {
|
|
|
|
expect(Service.parseId<double>('23.4'), 23.4);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('num', () {
|
|
|
|
expect(Service.parseId<num>('23.4'), 23.4);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('bool', () {
|
|
|
|
expect(Service.parseId<bool>('true'), true);
|
|
|
|
expect(Service.parseId<bool>(true), true);
|
|
|
|
expect(Service.parseId<bool>('false'), false);
|
|
|
|
expect(Service.parseId<bool>(false), false);
|
|
|
|
expect(Service.parseId<bool>('hmm'), false);
|
|
|
|
});
|
|
|
|
}
|