2021-05-28 16:15:17 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import { assert } from 'chai';
|
|
|
|
|
|
|
|
import {
|
|
|
|
actions,
|
|
|
|
getEmptyState,
|
|
|
|
reducer,
|
|
|
|
} from '../../../state/ducks/globalModals';
|
|
|
|
|
|
|
|
describe('both/state/ducks/globalModals', () => {
|
2021-08-18 20:08:14 +00:00
|
|
|
describe('toggleProfileEditor', () => {
|
|
|
|
const { toggleProfileEditor } = actions;
|
2021-05-28 16:15:17 +00:00
|
|
|
|
2021-08-18 20:08:14 +00:00
|
|
|
it('toggles isProfileEditorVisible', () => {
|
2021-05-28 16:15:17 +00:00
|
|
|
const state = getEmptyState();
|
2021-08-18 20:08:14 +00:00
|
|
|
const nextState = reducer(state, toggleProfileEditor());
|
2021-05-28 16:15:17 +00:00
|
|
|
|
2021-08-18 20:08:14 +00:00
|
|
|
assert.isTrue(nextState.isProfileEditorVisible);
|
2021-05-28 16:15:17 +00:00
|
|
|
|
2021-08-18 20:08:14 +00:00
|
|
|
const nextNextState = reducer(nextState, toggleProfileEditor());
|
2021-05-28 16:15:17 +00:00
|
|
|
|
2021-08-18 20:08:14 +00:00
|
|
|
assert.isFalse(nextNextState.isProfileEditorVisible);
|
2021-05-28 16:15:17 +00:00
|
|
|
});
|
|
|
|
});
|
2021-10-23 00:41:45 +00:00
|
|
|
|
|
|
|
describe('showWhatsNewModal/hideWhatsNewModal', () => {
|
|
|
|
const { showWhatsNewModal, hideWhatsNewModal } = actions;
|
|
|
|
|
|
|
|
it('toggles isWhatsNewVisible to true', () => {
|
|
|
|
const state = getEmptyState();
|
|
|
|
const nextState = reducer(state, showWhatsNewModal());
|
|
|
|
|
|
|
|
assert.isTrue(nextState.isWhatsNewVisible);
|
|
|
|
|
|
|
|
const nextNextState = reducer(nextState, hideWhatsNewModal());
|
|
|
|
|
|
|
|
assert.isFalse(nextNextState.isWhatsNewVisible);
|
|
|
|
});
|
|
|
|
});
|
2021-05-28 16:15:17 +00:00
|
|
|
});
|