Browse Source

dynamite_runtime: Enable skipped tests

pull/440/head
jld3103 1 year ago
parent
commit
ced0d2bfbe
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 290
      packages/dynamite/dynamite_runtime/test/content_string_test.dart

290
packages/dynamite/dynamite_runtime/test/content_string_test.dart

@ -57,28 +57,24 @@ void main() {
}); });
}); });
group( group('ContentString with unknown specifiedType holding bool', () {
'ContentString with unknown specifiedType holding bool', final data = ContentString((final b) => b..content = true);
() { final serialized = json.decode(
final data = ContentString((final b) => b..content = true); json.encode({
final serialized = json.decode( r'$': 'ContentString',
json.encode({ 'content': {r'$': 'bool', '': true}
r'$': 'ContentString', }),
'content': {r'$': 'bool', '': true} ) as Object;
}), const specifiedType = FullType.unspecified;
) as Object;
const specifiedType = FullType.unspecified;
test('can be serialized', () { test('can be serialized', () {
expect(serializers.serialize(data, specifiedType: specifiedType), serialized); expect(serializers.serialize(data, specifiedType: specifiedType), serialized);
}); });
test('can be deserialized', () { test('can be deserialized', () {
expect(serializers.deserialize(serialized, specifiedType: specifiedType), data); expect(serializers.deserialize(serialized, specifiedType: specifiedType), data);
}); });
}, });
skip: true,
);
group('ContentString with known specifiedType holding double', () { group('ContentString with known specifiedType holding double', () {
final data = ContentString<double>((final b) => b..content = 42.5); final data = ContentString<double>((final b) => b..content = 42.5);
@ -94,28 +90,24 @@ void main() {
}); });
}); });
group( group('ContentString with unknown specifiedType holding double', () {
'ContentString with unknown specifiedType holding double', final data = ContentString((final b) => b..content = 42.5);
() { final serialized = json.decode(
final data = ContentString((final b) => b..content = 42.5); json.encode({
final serialized = json.decode( r'$': 'ContentString',
json.encode({ 'content': {r'$': 'double', '': 42.5}
r'$': 'ContentString', }),
'content': {r'$': 'double', '': 42.5} ) as Object;
}), const specifiedType = FullType.unspecified;
) as Object;
const specifiedType = FullType.unspecified;
test('can be serialized', () { test('can be serialized', () {
expect(serializers.serialize(data, specifiedType: specifiedType), serialized); expect(serializers.serialize(data, specifiedType: specifiedType), serialized);
}); });
test('can be deserialized', () { test('can be deserialized', () {
expect(serializers.deserialize(serialized, specifiedType: specifiedType), data); expect(serializers.deserialize(serialized, specifiedType: specifiedType), data);
}); });
}, });
skip: true,
);
group('ContentString with known specifiedType holding list', () { group('ContentString with known specifiedType holding list', () {
final data = ContentString<BuiltList<int>>((final b) => b..content = BuiltList([1, 2, 3])); final data = ContentString<BuiltList<int>>((final b) => b..content = BuiltList([1, 2, 3]));
@ -133,35 +125,31 @@ void main() {
}); });
}); });
group( group('ContentString with unknown specifiedType holding list', () {
'ContentString with unknown specifiedType holding list', final data = ContentString((final b) => b..content = BuiltList([1, 2, 3]));
() { final serialized = json.decode(
final data = ContentString((final b) => b..content = BuiltList([1, 2, 3])); json.encode({
final serialized = json.decode( r'$': 'ContentString',
json.encode({ 'content': {
r'$': 'ContentString', r'$': 'list',
'content': { '': [
r'$': 'list', {r'$': 'int', '': 1},
'': [ {r'$': 'int', '': 2},
{r'$': 'int', '': 1}, {r'$': 'int', '': 3}
{r'$': 'int', '': 2}, ]
{r'$': 'int', '': 3} }
] }),
} ) as Object;
}), const specifiedType = FullType.unspecified;
) as Object;
const specifiedType = FullType.unspecified;
test('can be serialized', () { test('can be serialized', () {
expect(serializers.serialize(data, specifiedType: specifiedType), serialized); expect(serializers.serialize(data, specifiedType: specifiedType), serialized);
}); });
test('can be deserialized', () { test('can be deserialized', () {
expect(serializers.deserialize(serialized, specifiedType: specifiedType), data); expect(serializers.deserialize(serialized, specifiedType: specifiedType), data);
}); });
}, });
skip: true,
);
group('ContentString with known specifiedType holding map', () { group('ContentString with known specifiedType holding map', () {
final data = final data =
@ -182,33 +170,29 @@ void main() {
}); });
}); });
group( group('ContentString with unknown specifiedType holding map', () {
'ContentString with unknown specifiedType holding map', final data = ContentString((final b) => b..content = BuiltMap({'one': 1, 'two': 2, 'three': 3}));
() { final serialized = json.decode(
final data = ContentString((final b) => b..content = BuiltMap({'one': 1, 'two': 2, 'three': 3})); json.encode({
final serialized = json.decode( r'$': 'ContentString',
json.encode({ 'content': {
r'$': 'ContentString', r'$': 'encoded_map',
'content': { r'{"$":"String","":"one"}': {r'$': 'int', '': 1},
r'$': 'encoded_map', r'{"$":"String","":"two"}': {r'$': 'int', '': 2},
r'{"$":"String","":"one"}': {r'$': 'int', '': 1}, r'{"$":"String","":"three"}': {r'$': 'int', '': 3}
r'{"$":"String","":"two"}': {r'$': 'int', '': 2}, }
r'{"$":"String","":"three"}': {r'$': 'int', '': 3} }),
} ) as Object;
}), const specifiedType = FullType.unspecified;
) as Object;
const specifiedType = FullType.unspecified;
test('can be serialized', () { test('can be serialized', () {
expect(serializers.serialize(data, specifiedType: specifiedType), serialized); expect(serializers.serialize(data, specifiedType: specifiedType), serialized);
}); });
test('can be deserialized', () { test('can be deserialized', () {
expect(serializers.deserialize(serialized, specifiedType: specifiedType), data); expect(serializers.deserialize(serialized, specifiedType: specifiedType), data);
}); });
}, });
skip: true,
);
group( group(
'ContentString with known specifiedType holding int', 'ContentString with known specifiedType holding int',
@ -227,28 +211,24 @@ void main() {
}, },
); );
group( group('ContentString with unknown specifiedType holding int', () {
'ContentString with unknown specifiedType holding int', final data = ContentString((final b) => b..content = 42);
() { final serialized = json.decode(
final data = ContentString((final b) => b..content = 42); json.encode({
final serialized = json.decode( r'$': 'ContentString',
json.encode({ 'content': {r'$': 'int', '': 42}
r'$': 'ContentString', }),
'content': {r'$': 'int', '': 42} ) as Object;
}), const specifiedType = FullType.unspecified;
) as Object;
const specifiedType = FullType.unspecified;
test('can be serialized', () { test('can be serialized', () {
expect(serializers.serialize(data, specifiedType: specifiedType), serialized); expect(serializers.serialize(data, specifiedType: specifiedType), serialized);
}); });
test('can be deserialized', () { test('can be deserialized', () {
expect(serializers.deserialize(serialized, specifiedType: specifiedType), data); expect(serializers.deserialize(serialized, specifiedType: specifiedType), data);
}); });
}, });
skip: true,
);
group('ContentString with known specifiedType holding String', () { group('ContentString with known specifiedType holding String', () {
final data = ContentString<String>((final b) => b..content = 'test'); final data = ContentString<String>((final b) => b..content = 'test');
@ -264,28 +244,24 @@ void main() {
}); });
}); });
group( group('ContentString with unknown specifiedType holding String', () {
'ContentString with unknown specifiedType holding String', final data = ContentString((final b) => b..content = 'test');
() { final serialized = json.decode(
final data = ContentString((final b) => b..content = 'test'); json.encode({
final serialized = json.decode( r'$': 'ContentString',
json.encode({ 'content': {r'$': 'String', '': 'test'}
r'$': 'ContentString', }),
'content': {r'$': 'String', '': 'test'} ) as Object;
}), const specifiedType = FullType.unspecified;
) as Object;
const specifiedType = FullType.unspecified;
test('can be serialized', () { test('can be serialized', () {
expect(serializers.serialize(data, specifiedType: specifiedType), serialized); expect(serializers.serialize(data, specifiedType: specifiedType), serialized);
}); });
test('can be deserialized', () { test('can be deserialized', () {
expect(serializers.deserialize(serialized, specifiedType: specifiedType), data); expect(serializers.deserialize(serialized, specifiedType: specifiedType), data);
}); });
}, });
skip: true,
);
group('ContentString with known specifiedType holding ContentString', () { group('ContentString with known specifiedType holding ContentString', () {
final data = ContentString<ContentString<String>>( final data = ContentString<ContentString<String>>(
@ -308,34 +284,30 @@ void main() {
}); });
}); });
group( group('ContentString with unknown specifiedType holding ContentString', () {
'ContentString with unknown specifiedType holding ContentString', final data = ContentString<ContentString<String>>(
() { (final b) => b
final data = ContentString<ContentString<String>>( ..content = ContentString<String>(
(final b) => b (final b) => b..content = 'test',
..content = ContentString<String>( ),
(final b) => b..content = 'test', );
), final serialized = json.decode(
); json.encode({
final serialized = json.decode( r'$': 'ContentString',
json.encode({ 'content': {
r'$': 'ContentString', r'$': 'ContentString',
'content': { 'content': {r'$': 'String', '': 'test'}
r'$': 'ContentString', }
'content': {r'$': 'String', '': 'test'} }),
} ) as Object;
}), const specifiedType = FullType.unspecified;
) as Object;
const specifiedType = FullType.unspecified;
test('can be serialized', () { test('can be serialized', () {
expect(serializers.serialize(data, specifiedType: specifiedType), serialized); expect(serializers.serialize(data, specifiedType: specifiedType), serialized);
}); });
test('can be deserialized', () { test('can be deserialized', () {
expect(serializers.deserialize(serialized, specifiedType: specifiedType), data); expect(serializers.deserialize(serialized, specifiedType: specifiedType), data);
}); });
}, });
skip: false,
);
} }

Loading…
Cancel
Save