platform/packages/framework/test/parse_id_test.dart

34 lines
791 B
Dart
Raw Normal View History

import 'package:platform_framework/platform_framework.dart';
import 'package:test/test.dart';
void main() {
test('null', () {
expect(Service.parseId('null'), 'null');
expect(Service.parseId(null), 'null');
});
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);
});
}