Skip to content

Commit

Permalink
feat(jest): 100% branch coverage for store/webrtc/mutations (#3774)
Browse files Browse the repository at this point in the history
  • Loading branch information
drepram committed Jun 21, 2022
1 parent e35298a commit f13dc44
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions store/webrtc/mutations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ describe('Mutate WebRTC by setting', () => {
})
})

it('should initialize with default value for parameters', () => {
const localStateForUnitTest = { ...state }
inst.setInitialized(localStateForUnitTest)

expect(localStateForUnitTest).toMatchObject({
webrtc: { initialized: true },
})
})

it('should set incoming call', () => {
const localStateForUnitTest = { ...state }
inst.setIncomingCall(localStateForUnitTest, '0x0')
Expand Down Expand Up @@ -137,6 +146,49 @@ describe('Mutate WebRTC by setting', () => {
})
})

it('should set streamMuted without peerId', () => {
const localStateForUnitTest = { ...state }
const argument = {
peerId: null,
audio: true,
video: true,
screen: true,
}
inst.setStreamMuted(localStateForUnitTest, argument)

expect(localStateForUnitTest).not.toMatchObject({
streamMuted: {
id: {
audio: true,
video: true,
screen: true,
},
},
})
})

it('should set streamMuted without peerId and with default arguments', () => {
const localStateForUnitTest = { ...state }
const argument = {
peerId: null,
// Commented out because we want to test if default values will come in.
// audio: true,
// video: true,
// screen: true,
}
inst.setStreamMuted(localStateForUnitTest, argument)

expect(localStateForUnitTest).not.toMatchObject({
streamMuted: {
id: {
audio: true,
video: true,
screen: true,
},
},
})
})

it('should set muted', () => {
const localStateForUnitTest = { ...state }
const argument = {
Expand Down

0 comments on commit f13dc44

Please sign in to comment.