mirror of
https://github.com/foss42/apidash.git
synced 2025-05-26 10:46:40 +08:00
44 lines
972 B
Dart
44 lines
972 B
Dart
import 'package:seed/seed.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
const nmRow1 = NameValueModel(
|
|
name: "harry",
|
|
value: 23,
|
|
);
|
|
|
|
test('Testing toString()', () {
|
|
const resultExpected = 'NameValueModel(name: harry, value: 23)';
|
|
expect(nmRow1.toString(), resultExpected);
|
|
});
|
|
|
|
test('Testing toJson()', () {
|
|
const resultExpected = {
|
|
"name": "harry",
|
|
"value": 23,
|
|
};
|
|
expect(nmRow1.toJson(), resultExpected);
|
|
});
|
|
test('Testing fromJson()', () {
|
|
const resultExpected = nmRow1;
|
|
expect(
|
|
NameValueModel.fromJson({
|
|
"name": "harry",
|
|
"value": 23,
|
|
}),
|
|
resultExpected);
|
|
});
|
|
|
|
test('Testing copyWith()', () {
|
|
const resultExpected = NameValueModel(
|
|
name: "winter",
|
|
value: "26",
|
|
);
|
|
expect(nmRow1.copyWith(name: "winter", value: "26"), resultExpected);
|
|
});
|
|
|
|
test('Testing hashcode', () {
|
|
expect(nmRow1.hashCode, greaterThan(0));
|
|
});
|
|
}
|