TT#71331 Test conference store

To only test the conference store, change

describe('ConferenceModule', function(){

into

describe.only('ConferenceModule', function(){

on line 7 of t/store/conference.js


Change-Id: Iec745f5ff4512f337d9bddb2009ae55554bb8e32
changes/11/35811/5
Carlo Venusino 6 years ago
parent 9f7006d237
commit 5d9acff718

@ -206,22 +206,23 @@ export default {
},
participantLeft(state, participant) {
state.participants = state.participants.filter(($participant) => {
return participant.getId() !== $participant;
});
},
setSelectedParticipant(state, participant){
if(state.selectedParticipant == 'local' && !state.joinState === RequestState.succeeded){
state.selectedParticipant = null;
}
else if(state.selectedParticipant == participant.getId()){
else if(state.selectedParticipant == participant){
state.selectedParticipant = 'local';
state.manualSelection = false;
}
state.participants = state.participants.filter(($participant) => {
return participant.getId() !== $participant;
});
Vue.delete(state.remoteMediaStreams, participant.getId());
else{
state.selectedParticipant = participant;
}
},
setSelectedParticipant(state, participant){
state.selectedParticipant = participant;
},
setManualSelection(state, val){
state.manualSelection = val;
}

@ -130,6 +130,7 @@ export const store = new Vuex.Store({
}).onConferenceParticipantLeft((participant)=>{
store.commit('conference/participantLeft', participant);
store.commit('conference/removeRemoteMedia', participant.id);
store.commit('conference/setSelectedParticipant', 'local');
}).onConferenceEvent((event)=>{
store.commit('conference/event', event);
}).onConferenceMessage((message)=>{

@ -0,0 +1,109 @@
'use strict';
import ConferenceModule from '../../src/store/conference';
import { assert } from 'chai';
describe('ConferenceModule', function(){
it('should add a participant id to the store if not already stored', () => {
let state = {
participants: []
};
const participant = {
getId: () => {
return '123456789';
}
};
ConferenceModule.mutations.participantJoined(state, participant);
assert.include(state.participants, participant.getId());
});
it('should not add a participant id to the store if already stored', () => {
let state = {
participants: ['123456789']
};
const participant = {
getId: () => {
return '123456789';
}
};
ConferenceModule.mutations.participantJoined(state, participant);
assert.equal(state.participants.length, 1);
});
it('should remove a participant id from the store', () => {
let state = {
participants: ['123456789']
};
const participant = {
getId: () => {
return '123456789';
}
};
ConferenceModule.mutations.participantLeft(state, participant);
assert.notInclude(state.participants, participant.getId());
});
it('should add a participant mediastream to the store', () => {
let state = {
remoteMediaStreams: {}
};
const participantId = '123456789';
ConferenceModule.mutations.addRemoteMedia(state, participantId);
assert.exists(state.remoteMediaStreams[participantId]);
});
it('should remove a participant mediastream from the store', () => {
let state = {
remoteMediaStreams: {
123456789: '123456789'
}
};
const participantId = '123456789';
ConferenceModule.mutations.removeRemoteMedia(state, participantId);
assert.notExists(state.remoteMediaStreams[participantId]);
});
it('should store the selected remote participant as selected', () => {
let state = {
selectedParticipant: null
};
const participantId = '123456789';
ConferenceModule.mutations.setSelectedParticipant(state, participantId);
assert.equal(state.selectedParticipant, participantId);
});
it('should store the local participant as selected', () => {
let state = {
selectedParticipant: '123456789'
};
const participantId = '123456789';
ConferenceModule.mutations.setSelectedParticipant(state, participantId);
assert.equal(state.selectedParticipant, 'local');
});
it('should reset the selected participant when conference ends', () => {
let state = {
selectedParticipant: 'local',
joinState: false
};
ConferenceModule.mutations.setSelectedParticipant(state);
assert.equal(state.selectedParticipant, null);
});
});
Loading…
Cancel
Save