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

Loading…
Cancel
Save