mirror of
https://github.com/foss42/apidash.git
synced 2025-10-20 05:03:29 +08:00
Update tests
This commit is contained in:
@ -1,20 +0,0 @@
|
|||||||
import 'package:test/test.dart';
|
|
||||||
import 'package:apidash/models/name_value_model.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
const kvRow1 = NameValueModel(name: "harry", value: 23);
|
|
||||||
String kvRow1Expected = "{harry: 23}";
|
|
||||||
|
|
||||||
test('Testing toString()', () {
|
|
||||||
expect(kvRow1.toString(), kvRow1Expected);
|
|
||||||
});
|
|
||||||
|
|
||||||
const kvRow2Expected = NameValueModel(name: "winter", value: "26");
|
|
||||||
test('Testing copyWith()', () {
|
|
||||||
expect(kvRow1.copyWith(name: "winter", value: "26"), kvRow2Expected);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Testing hashcode', () {
|
|
||||||
expect(kvRow1.hashCode, greaterThan(0));
|
|
||||||
});
|
|
||||||
}
|
|
20
test/models/name_value_model_test.dart
Normal file
20
test/models/name_value_model_test.dart
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:apidash/models/name_value_model.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
const nmRow1 = NameValueModel(name: "harry", value: 23);
|
||||||
|
|
||||||
|
test('Testing toString()', () {
|
||||||
|
const nmRow1Expected = {"name": "harry", "value": 23};
|
||||||
|
expect(nmRow1.toJson(), nmRow1Expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Testing copyWith()', () {
|
||||||
|
const nmRow2Expected = NameValueModel(name: "winter", value: "26");
|
||||||
|
expect(nmRow1.copyWith(name: "winter", value: "26"), nmRow2Expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Testing hashcode', () {
|
||||||
|
expect(nmRow1.hashCode, greaterThan(0));
|
||||||
|
});
|
||||||
|
}
|
Reference in New Issue
Block a user