platform/test/basic_test.dart

20 lines
456 B
Dart
Raw Normal View History

2016-12-26 01:09:24 +00:00
import 'package:angel_validate/angel_validate.dart';
import 'package:test/test.dart';
final Validator todoSchema = new Validator({
'id': [isInt, isPositive],
'text*': isString,
'completed*': isBool
}, defaultValues: {
'completed': false
});
main() {
test('todo', () {
expect(() {
todoSchema
.enforce({'id': 'fool', 'text': 'Hello, world!', 'completed': 4});
}, throwsA(new isInstanceOf<ValidationException>()));
});
}