-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into Schema-read/write
- Loading branch information
Showing
7 changed files
with
451 additions
and
129 deletions.
There are no files selected for viewing
50 changes: 0 additions & 50 deletions
50
test/unit/auth/user_login/user_login_validate_message_test.dart
This file was deleted.
Oops, something went wrong.
64 changes: 0 additions & 64 deletions
64
test/unit/auth/user_login/user_login_validate_regex_test.dart
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import 'package:ext_rw/src/table_schema/field.dart'; | ||
import 'package:ext_rw/src/table_schema/relation.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
group('Field constructor', () { | ||
test('sets default values with only required parameters provided', () { | ||
const key = 'key'; | ||
const field = Field(key: key); | ||
expect(field.key, equals(key)); | ||
expect(field.name, equals(key)); | ||
expect(field.hidden, equals(false)); | ||
expect(field.edit, equals(true)); | ||
expect(field.relation, equals(const Relation.empty())); | ||
}); | ||
test('sets provided values', () { | ||
const valueMaps = [ | ||
{ | ||
'key': '123af', | ||
'name': 'wejlrk', | ||
'hidden': true, | ||
'edit': true, | ||
'relation': Relation(id: '1', field: '_+-+()*&^%\$;:?№"#@!`~\\|/.,[]{}'), | ||
}, | ||
{ | ||
'key': '_+-+()*&^%\$;:?№"#@!`~\\|/.,[]{}', | ||
'name': 'WEJLRK', | ||
'hidden': false, | ||
'edit': false, | ||
'relation': Relation(id: '_+-+()*&^%\$;:?№"#@!`~\\|/.,[]{}', field: 'reydfg'), | ||
}, | ||
{ | ||
'key': 'KJLSDFKJuio)()', | ||
'name': '_+-+()*&^%\$;:?№"#@!`~\\|/.,[]{}', | ||
'hidden': true, | ||
'edit': false, | ||
'relation': Relation.empty(), | ||
}, | ||
{ | ||
'key': '&^A*23jh4b#@\$%^&', | ||
'name': '&^*(hjl)', | ||
'hidden': false, | ||
'edit': true, | ||
'relation': Relation(id: '235', field: 'dfghew54'), | ||
}, | ||
{ | ||
'key': '35i4ilj32n', | ||
'name': 'nsewjri', | ||
'hidden': true, | ||
'edit': false, | ||
'relation': Relation(id: '1sgd43', field: 'sdg543'), | ||
}, | ||
]; | ||
for(final map in valueMaps) { | ||
final { | ||
'key': key, | ||
'name': name, | ||
'hidden': hidden, | ||
'edit': edit, | ||
'relation': relation, | ||
} = map; | ||
final field = Field( | ||
key: key as String, | ||
name: name as String, | ||
hidden: hidden as bool, | ||
edit: edit as bool, | ||
relation: relation as Relation, | ||
); | ||
expect(field.key, equals(key)); | ||
expect(field.name, equals(name)); | ||
expect(field.hidden, equals(hidden)); | ||
expect(field.edit, equals(edit)); | ||
expect(field.relation, equals(relation)); | ||
} | ||
}); | ||
}); | ||
} |
124 changes: 124 additions & 0 deletions
124
test/unit/table_schema/field_value/field_value_constructor_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
import 'package:ext_rw/src/table_schema/field_value.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
class _TestObject { | ||
const _TestObject(); | ||
} | ||
|
||
void main() { | ||
group('FieldValue constructor', () { | ||
test('sets default values with only required parameters provided', () { | ||
const values = [3456, 0, -124 -2345.56, 0.0, 234111.0, 'abc', '', true, _TestObject()]; | ||
for(final value in values) { | ||
final fieldValue = FieldValue(value); | ||
expect(fieldValue.value, equals(value)); | ||
expect(fieldValue.type, equals(FieldType.string)); | ||
} | ||
}); | ||
test('sets provided arguments', () { | ||
const valueMaps = [ | ||
{ | ||
'value': '_+-+()*&^%\$;:?№"#@!`~\\|/.,[]{}', | ||
'type': FieldType.string, | ||
}, | ||
{ | ||
'value': '_+-+()*&^%\$;:?№"#@!`~\\|/.,[]{}', | ||
'type': FieldType.int, | ||
}, | ||
{ | ||
'value': '_+-+()*&^%\$;:?№"#@!`~\\|/.,[]{}', | ||
'type': FieldType.double, | ||
}, | ||
{ | ||
'value': '_+-+()*&^%\$;:?№"#@!`~\\|/.,[]{}', | ||
'type': FieldType.bool, | ||
}, | ||
{ | ||
'value': 123, | ||
'type': FieldType.string, | ||
}, | ||
{ | ||
'value': 123, | ||
'type': FieldType.int, | ||
}, | ||
{ | ||
'value': 123, | ||
'type': FieldType.double, | ||
}, | ||
{ | ||
'value': 123, | ||
'type': FieldType.bool, | ||
}, | ||
{ | ||
'value': 321.321, | ||
'type': FieldType.string, | ||
}, | ||
{ | ||
'value': 321.321, | ||
'type': FieldType.int, | ||
}, | ||
{ | ||
'value': 321.321, | ||
'type': FieldType.double, | ||
}, | ||
{ | ||
'value': 321.321, | ||
'type': FieldType.bool, | ||
}, | ||
{ | ||
'value': false, | ||
'type': FieldType.string, | ||
}, | ||
{ | ||
'value': false, | ||
'type': FieldType.int, | ||
}, | ||
{ | ||
'value': false, | ||
'type': FieldType.double, | ||
}, | ||
{ | ||
'value': false, | ||
'type': FieldType.bool, | ||
}, | ||
{ | ||
'value': null, | ||
'type': FieldType.string, | ||
}, | ||
{ | ||
'value': null, | ||
'type': FieldType.int, | ||
}, | ||
{ | ||
'value': null, | ||
'type': FieldType.double, | ||
}, | ||
{ | ||
'value': null, | ||
'type': FieldType.bool, | ||
}, | ||
{ | ||
'value': _TestObject(), | ||
'type': FieldType.string, | ||
}, | ||
{ | ||
'value': _TestObject(), | ||
'type': FieldType.int, | ||
}, | ||
{ | ||
'value': _TestObject(), | ||
'type': FieldType.double, | ||
}, | ||
{ | ||
'value': _TestObject(), | ||
'type': FieldType.bool, | ||
}, | ||
]; | ||
for(final {'value': value, 'type': type as FieldType} in valueMaps) { | ||
final fieldValue = FieldValue(value, type: type); | ||
expect(fieldValue.value, equals(value)); | ||
expect(fieldValue.type, equals(type)); | ||
} | ||
}); | ||
}); | ||
} |
Oops, something went wrong.