platform/angel_serialize_generator/test/serializer_test.dart

19 lines
418 B
Dart
Raw Normal View History

2019-01-07 01:38:04 +00:00
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);
});
}