Spaces:
Sleeping
Sleeping
File size: 767 Bytes
7aec436 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import {recursivelyDeserializeBlobs, recursivelySerializeBlobs} from "../../src/p4/blob-serializer";
global.Blob = class {};
test('basic cloning functionality', async () => {
const object = {
a: {
b: [
{
c: 3,
d: "test"
}
],
z: [
'abcdef'
]
},
e: true
};
const serialized = await recursivelySerializeBlobs(object);
const deserialized = recursivelyDeserializeBlobs(serialized);
expect(serialized).toEqual(object);
expect(deserialized).toEqual(object);
});
test('cant serialize __isBlob', async () => {
await expect(recursivelySerializeBlobs({
__isBlob: true
})).rejects.toEqual(new Error(`Can't serialize special key: __isBlob`));
});
|