mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-27 04:13:12 +00:00
30 lines
714 B
TypeScript
30 lines
714 B
TypeScript
import { expect } from 'chai';
|
|
import fc from 'fast-check';
|
|
|
|
import { WakuMessage } from './waku_message';
|
|
|
|
describe('Waku Message', function () {
|
|
it('Waku message round trip binary serialization', function () {
|
|
fc.assert(
|
|
fc.property(fc.string(), (s) => {
|
|
const msg = WakuMessage.fromUtf8String(s);
|
|
const binary = msg.encode();
|
|
const actual = WakuMessage.decode(binary);
|
|
|
|
expect(actual).to.deep.equal(msg);
|
|
})
|
|
);
|
|
});
|
|
|
|
it('Payload to utf-8', function () {
|
|
fc.assert(
|
|
fc.property(fc.string(), (s) => {
|
|
const msg = WakuMessage.fromUtf8String(s);
|
|
const utf8 = msg.payloadAsUtf8;
|
|
|
|
return utf8 === s;
|
|
})
|
|
);
|
|
});
|
|
});
|