Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jest): 100% branch coverage for store/webrtc/mutations #3774

Merged
merged 1 commit into from
Jun 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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