fixup-tests

pull/1242/head
Vincent 5 years ago
parent 5216cc2c2e
commit 7896671df0

@ -9,6 +9,7 @@ import {
import { SignalService } from '../../../protobuf';
import { TextEncoder } from 'util';
import { toNumber } from 'lodash';
import { Constants } from '../../../session';
describe('ChatMessage', () => {
it('can create empty message with just a timestamp', () => {
@ -128,11 +129,11 @@ describe('ChatMessage', () => {
expect(firstAttachment?.url).to.be.deep.equal('url');
});
it('ttl of 1 day', () => {
it('correct ttl', () => {
const message = new ChatMessage({
timestamp: Date.now(),
});
expect(message.ttl()).to.equal(24 * 60 * 60 * 1000);
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.REGULAR_MESSAGE);
});
it('has an identifier', () => {

@ -9,6 +9,7 @@ import { TextEncoder } from 'util';
import { TestUtils } from '../../test-utils';
import { StringUtils } from '../../../session/utils';
import { PubKey } from '../../../session/types';
import { Constants } from '../../../session';
describe('ClosedGroupChatMessage', () => {
let groupId: PubKey;
@ -44,7 +45,7 @@ describe('ClosedGroupChatMessage', () => {
.to.be.equal(chatMessage.timestamp);
});
it('ttl of 1 day', () => {
it('correct ttl', () => {
const chatMessage = new ChatMessage({
timestamp: Date.now(),
});
@ -52,7 +53,7 @@ describe('ClosedGroupChatMessage', () => {
groupId,
chatMessage,
});
expect(message.ttl()).to.equal(24 * 60 * 60 * 1000);
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.REGULAR_MESSAGE);
});
it('has an identifier', () => {

@ -7,6 +7,7 @@ import {
} from '../../../session/messages/outgoing';
import { SignalService } from '../../../protobuf';
import { LokiProfile } from '../../../types/Message';
import { Constants } from '../../../session';
describe('DeviceLinkMessage', () => {
let linkRequestMessage: DeviceLinkRequestMessage;
@ -115,9 +116,9 @@ describe('DeviceLinkMessage', () => {
});
});
it('ttl of 2 minutes', () => {
expect(linkRequestMessage.ttl()).to.equal(2 * 60 * 1000);
expect(linkGrantMessage.ttl()).to.equal(2 * 60 * 1000);
it('correct ttl', () => {
expect(linkRequestMessage.ttl()).to.equal(Constants.TTL_DEFAULT.PAIRING_REQUEST);
expect(linkGrantMessage.ttl()).to.equal(Constants.TTL_DEFAULT.PAIRING_REQUEST);
});
it('has an identifier', () => {

@ -3,6 +3,7 @@ import { beforeEach } from 'mocha';
import { DeviceUnlinkMessage } from '../../../session/messages/outgoing';
import { SignalService } from '../../../protobuf';
import { Constants } from '../../../session';
describe('DeviceUnlinkMessage', () => {
let message: DeviceUnlinkMessage;
@ -21,8 +22,8 @@ describe('DeviceUnlinkMessage', () => {
);
});
it('ttl of 4 days', () => {
expect(message.ttl()).to.equal(4 * 24 * 60 * 60 * 1000);
it('correct ttl', () => {
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.DEVICE_UNPAIRING);
});
it('has an identifier', () => {

@ -4,6 +4,7 @@ import { beforeEach } from 'mocha';
import { EndSessionMessage } from '../../../session/messages/outgoing';
import { SignalService } from '../../../protobuf';
import { TextEncoder } from 'util';
import { Constants } from '../../../session';
describe('EndSessionMessage', () => {
let message: EndSessionMessage;
@ -64,8 +65,8 @@ describe('EndSessionMessage', () => {
expect(decoded.dataMessage).to.have.deep.property('body', 'TERMINATE');
});
it('ttl of 4 days', () => {
expect(message.ttl()).to.equal(4 * 24 * 60 * 60 * 1000);
it('correct ttl', () => {
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.END_SESSION_MESSAGE);
});
it('has an identifier', () => {

@ -3,6 +3,7 @@ import { beforeEach } from 'mocha';
import { GroupInvitationMessage } from '../../../session/messages/outgoing';
import { SignalService } from '../../../protobuf';
import { Constants } from '../../../session';
describe('GroupInvitationMessage', () => {
let message: GroupInvitationMessage;
@ -38,8 +39,8 @@ describe('GroupInvitationMessage', () => {
);
});
it('ttl of 1 day', () => {
expect(message.ttl()).to.equal(24 * 60 * 60 * 1000);
it('correct ttl', () => {
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.REGULAR_MESSAGE);
});
it('has an identifier', () => {

@ -7,6 +7,7 @@ import {
} from '../../../session/messages/outgoing';
import { SignalService } from '../../../protobuf';
import { toNumber } from 'lodash';
import { Constants } from '../../../session';
describe('ReceiptMessage', () => {
let readMessage: ReadReceiptMessage;
@ -42,9 +43,9 @@ describe('ReceiptMessage', () => {
expect(decodedTimestamps).to.deep.equal(timestamps);
});
it('ttl of 1 day', () => {
expect(readMessage.ttl()).to.equal(24 * 60 * 60 * 1000);
expect(deliveryMessage.ttl()).to.equal(24 * 60 * 60 * 1000);
it('correct ttl', () => {
expect(readMessage.ttl()).to.equal(Constants.TTL_DEFAULT.REGULAR_MESSAGE);
expect(deliveryMessage.ttl()).to.equal(Constants.TTL_DEFAULT.REGULAR_MESSAGE);
});
it('has an identifier', () => {

@ -3,6 +3,7 @@ import { beforeEach } from 'mocha';
import { SessionEstablishedMessage } from '../../../session/messages/outgoing';
import { SignalService } from '../../../protobuf';
import { Constants } from '../../../session';
describe('SessionEstablishedMessage', () => {
let message: SessionEstablishedMessage;
@ -21,8 +22,8 @@ describe('SessionEstablishedMessage', () => {
);
});
it('ttl of 5 minutes', () => {
expect(message.ttl()).to.equal(5 * 60 * 1000);
it('correct ttl', () => {
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.SESSION_ESTABLISHED);
});
it('has an identifier', () => {

@ -4,6 +4,7 @@ import { beforeEach } from 'mocha';
import { SessionRequestMessage } from '../../../session/messages/outgoing';
import { SignalService } from '../../../protobuf';
import { TextDecoder, TextEncoder } from 'util';
import { Constants } from '../../../session';
describe('SessionRequestMessage', () => {
let message: SessionRequestMessage;
@ -64,8 +65,8 @@ describe('SessionRequestMessage', () => {
);
});
it('ttl of 4 days', () => {
expect(message.ttl()).to.equal(4 * 24 * 60 * 60 * 1000);
it('correct ttl', () => {
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.SESSION_REQUEST);
});
it('has an identifier', () => {

@ -7,6 +7,7 @@ import Long from 'long';
import { toNumber } from 'lodash';
import { StringUtils } from '../../../session/utils';
import { TestUtils } from '../../test-utils';
import { Constants } from '../../../session';
describe('TypingMessage', () => {
it('has Action.STARTED if isTyping = true', () => {
@ -79,12 +80,12 @@ describe('TypingMessage', () => {
);
});
it('ttl of 1 minute', () => {
it('correct ttl', () => {
const message = new TypingMessage({
timestamp: Date.now(),
isTyping: true,
});
expect(message.ttl()).to.equal(60 * 1000);
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.TYPING_MESSAGE);
});
it('has an identifier', () => {

Loading…
Cancel
Save