Skip to content

Commit

Permalink
feat(jest): 100% coverage for store/conversation/getters (#3527)
Browse files Browse the repository at this point in the history
  • Loading branch information
drepram authored Jun 9, 2022
1 parent e63a510 commit 02e3e82
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
14 changes: 14 additions & 0 deletions store/conversation/__snapshots__/getters.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,17 @@ Array [
},
]
`;

exports[`misc typingParticipants 1`] = `
Array [
Object {
"activity": "TYPING",
"address": "address2",
"name": "name2",
"peerId": "peerId2",
"profilePicture": "profilePicture2",
"state": "CONNECTED",
"updatedAt": 123,
},
]
`;
32 changes: 32 additions & 0 deletions store/conversation/getters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,36 @@ describe('misc', () => {

expect(result).toMatchSnapshot()
})

test('typingParticipants', () => {
const argument: ConversationParticipant[] = [
{
peerId: 'peerId',
address: 'address',
name: 'name',
profilePicture: 'profilePicture',
state: ConversationConnection.DISCONNECTED,
activity: ConversationActivity.ACTIVE, // This element in this array will not be this included because it is not TYPING (type)
updatedAt: 123,
},
{
peerId: 'peerId2',
address: 'address2',
name: 'name2',
profilePicture: 'profilePicture2',
state: ConversationConnection.CONNECTED,
activity: ConversationActivity.TYPING,
updatedAt: 123,
},
]
const localState = { ...InitialConversationState }
localState.participants = argument

const result: ConversationParticipant[] = module.default.typingParticipants(
localState,
{ otherParticipants: argument },
)

expect(result).toMatchSnapshot()
})
})

0 comments on commit 02e3e82

Please sign in to comment.