background.ts: Introduce types for redux initialState

This commit is contained in:
Scott Nonnenberg 2022-02-23 10:48:40 -08:00 committed by GitHub
parent 3673b6d101
commit 4763831d3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 315 additions and 238 deletions

View file

@ -222,6 +222,20 @@ describe('message send state utilities', () => {
)
);
});
it('returns false if the message is for you but we have no conversationId', () => {
assert.isFalse(
isMessageJustForMe(
{
[ourConversationId]: {
status: SendStatus.Sent,
updatedAt: 123,
},
},
undefined
)
);
});
});
describe('sendStateReducer', () => {

View file

@ -10,7 +10,7 @@ import { noopAction } from '../../../state/ducks/noop';
import type { PreferredReactionsStateType } from '../../../state/ducks/preferredReactions';
import {
actions,
getInitialState,
getEmptyState,
reducer,
} from '../../../state/ducks/preferredReactions';
@ -26,7 +26,7 @@ describe('preferred reactions duck', () => {
});
const stateWithOpenCustomizationModal = {
...getInitialState(),
...getEmptyState(),
customizePreferredReactionsModal: {
draftPreferredReactions: ['✨', '❇️', '🎇', '🦈', '💖', '🅿️'],
originalPreferredReactions: ['💙', '👍', '👎', '😂', '😮', '😢'],
@ -59,7 +59,7 @@ describe('preferred reactions duck', () => {
it("does nothing if the modal isn't open", () => {
const action = cancelCustomizePreferredReactionsModal();
const result = reducer(getInitialState(), action);
const result = reducer(getEmptyState(), action);
assert.notProperty(result, 'customizePreferredReactionsModal');
});
@ -76,7 +76,7 @@ describe('preferred reactions duck', () => {
const { deselectDraftEmoji } = actions;
it('is a no-op if the customization modal is not open', () => {
const state = getInitialState();
const state = getEmptyState();
const action = deselectDraftEmoji();
const result = reducer(state, action);
@ -167,7 +167,7 @@ describe('preferred reactions duck', () => {
const { replaceSelectedDraftEmoji } = actions;
it('is a no-op if the customization modal is not open', () => {
const state = getInitialState();
const state = getEmptyState();
const action = replaceSelectedDraftEmoji('🦈');
const result = reducer(state, action);
@ -350,7 +350,7 @@ describe('preferred reactions duck', () => {
};
it("does nothing if the modal isn't open", () => {
const result = reducer(getInitialState(), action);
const result = reducer(getEmptyState(), action);
assert.notProperty(result, 'customizePreferredReactionsModal');
});
@ -404,7 +404,7 @@ describe('preferred reactions duck', () => {
};
it("does nothing if the modal isn't open", () => {
const state = getInitialState();
const state = getEmptyState();
const result = reducer(state, action);
assert.strictEqual(result, state);
@ -428,7 +428,7 @@ describe('preferred reactions duck', () => {
const { selectDraftEmojiToBeReplaced } = actions;
it('is a no-op if the customization modal is not open', () => {
const state = getInitialState();
const state = getEmptyState();
const action = selectDraftEmojiToBeReplaced(2);
const result = reducer(state, action);