Timeline date headers

This commit is contained in:
Evan Hahn 2022-01-26 17:05:26 -06:00 committed by GitHub
parent 0fa069f260
commit f9440bf594
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 1183 additions and 771 deletions

View file

@ -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));
});
});
});