logos-delivery-js/src/lib/waku_message.spec.ts

16 lines
372 B
TypeScript
Raw Normal View History

import { fc, testProp } from 'jest-fast-check';
2021-03-12 14:23:21 +11:00
2021-03-10 16:22:49 +11:00
import { Message } from './waku_message';
testProp(
2021-03-15 15:45:41 +11:00
'Waku message round trip binary serialization',
[fc.fullUnicodeString()],
(s) => {
2021-03-12 14:23:21 +11:00
const msg = Message.fromUtf8String(s);
2021-03-10 16:22:49 +11:00
const binary = msg.toBinary();
const actual = Message.fromBinary(binary);
expect(actual.isEqualTo(msg)).toBeTruthy();
2021-03-10 16:22:49 +11:00
}
);