You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/ts/test/session/messages/SessionResetMessage_test.ts

33 lines
1.1 KiB
TypeScript

import { expect } from 'chai';
import { beforeEach} from 'mocha';
import { SessionResetMessage } from '../../../session/messages/outgoing';
import { SignalService } from '../../../protobuf';
describe('SessionResetMessage', () => {
let message: SessionResetMessage;
beforeEach(() => {
const timestamp = Date.now();
const preKeyBundle = {deviceId: 123456};
message = new SessionResetMessage({timestamp, preKeyBundle});
});
it('has a preKeyBundle', () => {
const plainText = message.plainTextBuffer();
const decoded = SignalService.Content.toObject(SignalService.Content.decode(plainText));
expect(decoded.preKeyBundleMessage).to.have.property('deviceId', 123456);
});
it('has a nullMessage not null', () => {
const plainText = message.plainTextBuffer();
const decoded = SignalService.Content.toObject(SignalService.Content.decode(plainText));
expect(decoded.nullMessage).to.be.not.equal(null, 'decoded.dataMessage.nullMessage should not be null');
});
it('ttl of 4 days', () => {
expect(message.ttl()).to.equal(4 * 24 * 60 * 60 * 1000);
});
});