platform/angel_serialize_generator/test/serializer_test.dart
2019-01-06 20:38:04 -05: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);
});
}