Timeline date headers
This commit is contained in:
parent
0fa069f260
commit
f9440bf594
41 changed files with 1183 additions and 771 deletions
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2020-2021 Signal Messenger, LLC
|
||||
// Copyright 2020-2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
|
@ -8,6 +8,7 @@ import {
|
|||
getPinnedConversationIds,
|
||||
getPreferredLeftPaneWidth,
|
||||
getPreferredReactionEmoji,
|
||||
getUsernamesEnabled,
|
||||
} from '../../../state/selectors/items';
|
||||
import type { StateType } from '../../../state/reducer';
|
||||
import type { ItemsStateType } from '../../../state/ducks/items';
|
||||
|
@ -143,4 +144,36 @@ describe('both/state/selectors/items', () => {
|
|||
assert.deepStrictEqual(actual, preferredReactionEmoji);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getUsernamesEnabled', () => {
|
||||
it('returns false if the flag is missing or disabled', () => {
|
||||
[
|
||||
{},
|
||||
{ remoteConfig: {} },
|
||||
{
|
||||
remoteConfig: {
|
||||
'desktop.usernames': {
|
||||
name: 'desktop.usernames' as const,
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
].forEach(itemsState => {
|
||||
const state = getRootState(itemsState);
|
||||
assert.isFalse(getUsernamesEnabled(state));
|
||||
});
|
||||
});
|
||||
|
||||
it('returns true if the flag is enabled', () => {
|
||||
const state = getRootState({
|
||||
remoteConfig: {
|
||||
'desktop.usernames': {
|
||||
name: 'desktop.usernames' as const,
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
assert.isTrue(getUsernamesEnabled(state));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
58
ts/test-both/state/selectors/user_test.ts
Normal file
58
ts/test-both/state/selectors/user_test.ts
Normal file
|
@ -0,0 +1,58 @@
|
|||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
|
||||
import type { StateType } from '../../../state/reducer';
|
||||
import type { UserStateType } from '../../../state/ducks/user';
|
||||
import { getEmptyState } from '../../../state/ducks/user';
|
||||
|
||||
import { getIsAlpha, getIsBeta } from '../../../state/selectors/user';
|
||||
|
||||
describe('both/state/selectors/user', () => {
|
||||
function getRootState(
|
||||
overrides: Readonly<Partial<UserStateType>>
|
||||
): StateType {
|
||||
return {
|
||||
user: {
|
||||
...getEmptyState(),
|
||||
...overrides,
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any;
|
||||
}
|
||||
|
||||
describe('#getIsAlpha', () => {
|
||||
it('returns false for beta', () => {
|
||||
const state = getRootState({ version: '1.23.4-beta.5' });
|
||||
assert.isFalse(getIsAlpha(state));
|
||||
});
|
||||
|
||||
it('returns false for production', () => {
|
||||
const state = getRootState({ version: '1.23.4' });
|
||||
assert.isFalse(getIsAlpha(state));
|
||||
});
|
||||
|
||||
it('returns true for alpha', () => {
|
||||
const state = getRootState({ version: '1.23.4-alpha.987' });
|
||||
assert.isTrue(getIsAlpha(state));
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getIsBeta', () => {
|
||||
it('returns false for alpha', () => {
|
||||
const state = getRootState({ version: '1.23.4-alpha.987' });
|
||||
assert.isFalse(getIsBeta(state));
|
||||
});
|
||||
|
||||
it('returns false for production', () => {
|
||||
const state = getRootState({ version: '1.23.4' });
|
||||
assert.isFalse(getIsBeta(state));
|
||||
});
|
||||
|
||||
it('returns true for beta', () => {
|
||||
const state = getRootState({ version: '1.23.4-beta.5' });
|
||||
assert.isTrue(getIsBeta(state));
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue