mirror of
https://github.com/foss42/apidash.git
synced 2025-06-06 03:18:43 +08:00
31 lines
903 B
Dart
31 lines
903 B
Dart
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 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));
|
|
});
|
|
}
|