Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field value tests #13

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/src/table_schema/schema.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import 'package:ext_rw/ext_rw.dart';
import 'package:ext_rw/src/sql/sql.dart';
import 'package:ext_rw/src/table_schema/field.dart';
import 'package:ext_rw/src/table_schema/schema_entry.dart';
import 'package:ext_rw/src/api_client/address/api_address.dart';
import 'package:ext_rw/src/api_client/query/sql_query.dart';
import 'package:ext_rw/src/api_client/request/api_request.dart';
import 'package:hmi_core/hmi_core_failure.dart';
import 'package:hmi_core/hmi_core_log.dart';
import 'package:hmi_core/hmi_core_result_new.dart';

///
typedef SqlBuilder<T extends SchemaEntry> = Sql Function(Sql sql, T entry);


///
/// A collection of the SchameEntry,
/// abstruction on the SQL table rows
Expand Down
50 changes: 0 additions & 50 deletions test/unit/auth/user_login/user_login_validate_message_test.dart

This file was deleted.

64 changes: 0 additions & 64 deletions test/unit/auth/user_login/user_login_validate_regex_test.dart

This file was deleted.

15 changes: 0 additions & 15 deletions test/unit/auth/user_login/user_login_value_test.dart

This file was deleted.

124 changes: 124 additions & 0 deletions test/unit/table_schema/field_value/field_value_constructor_test.dart
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));
}
});
});
}
Loading
Loading