-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move message selector tests to the right place
- Loading branch information
1 parent
92cbfc4
commit 65ad608
Showing
3 changed files
with
65 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2021 Signal Messenger, LLC | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
import { assert } from 'chai'; | ||
|
||
import { | ||
isEndSession, | ||
isGroupUpdate, | ||
isIncoming, | ||
isOutgoing, | ||
} from '../../../state/selectors/message'; | ||
|
||
describe('state/selectors/messages', () => { | ||
describe('isEndSession', () => { | ||
it('checks if it is end of the session', () => { | ||
assert.isFalse(isEndSession({})); | ||
assert.isFalse(isEndSession({ flags: undefined })); | ||
assert.isFalse(isEndSession({ flags: 0 })); | ||
assert.isFalse(isEndSession({ flags: 2 })); | ||
assert.isFalse(isEndSession({ flags: 4 })); | ||
|
||
assert.isTrue(isEndSession({ flags: 1 })); | ||
}); | ||
}); | ||
|
||
describe('isGroupUpdate', () => { | ||
it('checks if is group update', () => { | ||
assert.isFalse(isGroupUpdate({})); | ||
assert.isFalse(isGroupUpdate({ group_update: undefined })); | ||
|
||
assert.isTrue(isGroupUpdate({ group_update: { left: 'You' } })); | ||
}); | ||
}); | ||
|
||
describe('isIncoming', () => { | ||
it('checks if is incoming message', () => { | ||
assert.isFalse(isIncoming({ type: 'outgoing' })); | ||
assert.isFalse(isIncoming({ type: 'call-history' })); | ||
|
||
assert.isTrue(isIncoming({ type: 'incoming' })); | ||
}); | ||
}); | ||
|
||
describe('isOutgoing', () => { | ||
it('checks if is outgoing message', () => { | ||
assert.isFalse(isOutgoing({ type: 'incoming' })); | ||
assert.isFalse(isOutgoing({ type: 'call-history' })); | ||
|
||
assert.isTrue(isOutgoing({ type: 'outgoing' })); | ||
}); | ||
}); | ||
}); |