Adds message forwarding
This commit is contained in:
parent
cd489a35fd
commit
d203f125c6
42 changed files with 1638 additions and 139 deletions
48
ts/test-both/state/ducks/linkPreviews_test.ts
Normal file
48
ts/test-both/state/ducks/linkPreviews_test.ts
Normal file
|
@ -0,0 +1,48 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
|
||||
import {
|
||||
actions,
|
||||
getEmptyState,
|
||||
reducer,
|
||||
} from '../../../state/ducks/linkPreviews';
|
||||
import { LinkPreviewType } from '../../../types/message/LinkPreviews';
|
||||
|
||||
describe('both/state/ducks/linkPreviews', () => {
|
||||
function getMockLinkPreview(): LinkPreviewType {
|
||||
return {
|
||||
title: 'Hello World',
|
||||
domain: 'signal.org',
|
||||
url: 'https://www.signal.org',
|
||||
isStickerPack: false,
|
||||
};
|
||||
}
|
||||
|
||||
describe('addLinkPreview', () => {
|
||||
const { addLinkPreview } = actions;
|
||||
|
||||
it('updates linkPreview', () => {
|
||||
const state = getEmptyState();
|
||||
const linkPreview = getMockLinkPreview();
|
||||
const nextState = reducer(state, addLinkPreview(linkPreview));
|
||||
|
||||
assert.strictEqual(nextState.linkPreview, linkPreview);
|
||||
});
|
||||
});
|
||||
|
||||
describe('removeLinkPreview', () => {
|
||||
const { removeLinkPreview } = actions;
|
||||
|
||||
it('removes linkPreview', () => {
|
||||
const state = {
|
||||
...getEmptyState(),
|
||||
linkPreview: getMockLinkPreview(),
|
||||
};
|
||||
const nextState = reducer(state, removeLinkPreview());
|
||||
|
||||
assert.isUndefined(nextState.linkPreview);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue