test: start setExpirationStartTimestamp

tested different modes
pull/2971/head
William Grant 2 years ago
parent 6379226410
commit 3a930eb323

@ -1,6 +1,11 @@
import { expect } from 'chai';
import Sinon from 'sinon';
import { stubWindowLog } from '../../../test-utils/utils';
import {
DisappearingMessageConversationModeType,
setExpirationStartTimestamp,
} from '../../../../util/expiringMessages';
import { isValidUnixTimestamp } from '../../../../session/utils/Timestamps';
describe('Disappearing Messages', () => {
stubWindowLog();
@ -13,30 +18,70 @@ describe('Disappearing Messages', () => {
Sinon.restore();
});
// ts/util/expiringMessages.ts
it('setExpirationStartTimestamp', async () => {
expect('TODO').to.be.eq('TODO');
});
describe('expiringMessages.ts', () => {
describe('setExpirationStartTimestamp', () => {
it('returns a valid unix timestamp for deleteAfterRead', async () => {
const mode: DisappearingMessageConversationModeType = 'deleteAfterRead';
const expirationStartTimestamp = setExpirationStartTimestamp(mode);
it('changeToDisappearingMessageType', async () => {
expect('TODO').to.be.eq('TODO');
});
expect(expirationStartTimestamp, 'it should return a number').to.be.is.a('number');
expect(
isValidUnixTimestamp(expirationStartTimestamp!),
'it should be a valid unix timestamp'
).to.be.true;
});
it('changeToDisappearingConversationMode', async () => {
expect('TODO').to.be.eq('TODO');
});
it('returns a valid unix timestamp for deleteAfterSend', async () => {
const mode: DisappearingMessageConversationModeType = 'deleteAfterSend';
const expirationStartTimestamp = setExpirationStartTimestamp(mode);
expect(expirationStartTimestamp, 'it should return a number').to.be.is.a('number');
expect(
isValidUnixTimestamp(expirationStartTimestamp!),
'it should be a valid unix timestamp'
).to.be.true;
});
it('returns undefined when disappearing messages is off', async () => {
const mode: DisappearingMessageConversationModeType = 'off';
const expirationStartTimestamp = setExpirationStartTimestamp(mode);
expect(expirationStartTimestamp, 'it should return undefined').to.be.undefined;
});
// TODO Test with timestamp argument
// Timestamp is bigger
// Timestamp is smaller
// Timestamp is the equal
// Timestamp is invalid
});
it('changeToDisappearingMessageType', async () => {
expect('TODO').to.be.eq('TODO');
});
it('changeToDisappearingConversationMode', async () => {
expect('TODO').to.be.eq('TODO');
});
it('checkForExpireUpdateInContentMessage', async () => {
expect('TODO').to.be.eq('TODO');
it('checkForExpireUpdateInContentMessage', async () => {
expect('TODO').to.be.eq('TODO');
});
});
// ts/models/conversation.ts
it('updateExpireTimer', async () => {
expect('TODO').to.be.eq('TODO');
describe('conversation.ts', () => {
describe('updateExpireTimer', () => {
it('TODO', async () => {
expect('TODO').to.be.eq('TODO');
});
});
});
// ts/models/message.ts
it('isExpirationTimerUpdate', async () => {
expect('TODO').to.be.eq('TODO');
describe('message.ts', () => {
describe('isExpirationTimerUpdate', () => {
it('TODO', async () => {
expect('TODO').to.be.eq('TODO');
});
});
});
});

Loading…
Cancel
Save