platform/packages/serialize/serialize_generator/test/serializer_test.dart
2024-10-12 18:45:27 -07:00

18 lines
418 B
Dart

import 'dart:convert';
import 'package:test/test.dart';
import 'models/has_map.dart';
void main() {
var m = HasMap(value: {'foo': 'bar'});
print(json.encode(m));
test('json', () {
expect(json.encode(m), r'{"value":"{\"foo\":\"bar\"}"}');
});
test('decode', () {
var mm = json.decode(r'{"value":"{\"foo\":\"bar\"}"}') as Map;
var mmm = HasMapSerializer.fromMap(mm);
expect(mmm, m);
});
}