This commit is contained in:
@@ -14,6 +14,8 @@ import type { MessageSearchResultType } from '../../../state/ducks/search';
|
||||
import { getEmptyState as getEmptySearchState } from '../../../state/ducks/search';
|
||||
import { getEmptyState as getEmptyUserState } from '../../../state/ducks/user';
|
||||
import {
|
||||
getIsSearching,
|
||||
getIsSearchingGlobally,
|
||||
getIsSearchingInAConversation,
|
||||
getMessageSearchResultSelector,
|
||||
getSearchResults,
|
||||
@@ -93,6 +95,61 @@ describe('both/state/selectors/search', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getIsSearchingGlobally', () => {
|
||||
it('returns false if not searching', () => {
|
||||
const state = getEmptyRootState();
|
||||
|
||||
assert.isFalse(getIsSearchingGlobally(state));
|
||||
});
|
||||
|
||||
it('returns true if searching globally', () => {
|
||||
const state = {
|
||||
...getEmptyRootState(),
|
||||
search: {
|
||||
...getEmptySearchState(),
|
||||
globalSearch: true,
|
||||
},
|
||||
};
|
||||
|
||||
assert.isTrue(getIsSearchingGlobally(state));
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getIsSearching', () => {
|
||||
it('returns false if not searching in any manner', () => {
|
||||
const state = getEmptyRootState();
|
||||
|
||||
assert.isFalse(getIsSearching(state));
|
||||
});
|
||||
|
||||
it('returns true if searching in a conversation', () => {
|
||||
const state = {
|
||||
...getEmptyRootState(),
|
||||
search: {
|
||||
...getEmptySearchState(),
|
||||
searchConversationId: 'abc123',
|
||||
searchConversationName: 'Test Conversation',
|
||||
globalSearch: false,
|
||||
},
|
||||
};
|
||||
|
||||
assert.isTrue(getIsSearching(state));
|
||||
});
|
||||
|
||||
it('returns true if searching globally', () => {
|
||||
const state = {
|
||||
...getEmptyRootState(),
|
||||
search: {
|
||||
...getEmptySearchState(),
|
||||
searchConversationId: undefined,
|
||||
globalSearch: true,
|
||||
},
|
||||
};
|
||||
|
||||
assert.isTrue(getIsSearchingGlobally(state));
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getMessageSearchResultSelector', () => {
|
||||
it('returns undefined if message not found in lookup', () => {
|
||||
const state = getEmptyRootState();
|
||||
|
Reference in New Issue
Block a user