import { createLocalVue } from '@vue/test-utils'
import storeConfig from './storeConfig'
import Vuex from 'vuex'
import { cloneDeep } from 'lodash'
import {
CONVERSATION,
WEBINAR,
PARTICIPANT,
ATTENDEE,
} from '../constants'
import {
makePublic,
makePrivate,
addToFavorites,
removeFromFavorites,
changeLobbyState,
changeReadOnlyState,
changeListable,
createOneToOneConversation,
setConversationName,
setConversationDescription,
setNotificationLevel,
setSIPEnabled,
fetchConversation,
fetchConversations,
deleteConversation,
} from '../services/conversationsService'
jest.mock('../services/conversationsService', () => ({
makePublic: jest.fn(),
makePrivate: jest.fn(),
addToFavorites: jest.fn(),
removeFromFavorites: jest.fn(),
changeLobbyState: jest.fn(),
changeReadOnlyState: jest.fn(),
changeListable: jest.fn(),
createOneToOneConversation: jest.fn(),
setConversationName: jest.fn(),
setConversationDescription: jest.fn(),
setNotificationLevel: jest.fn(),
setSIPEnabled: jest.fn(),
fetchConversation: jest.fn(),
fetchConversations: jest.fn(),
deleteConversation: jest.fn(),
}))
describe('conversationsStore', () => {
const testToken = 'XXTOKENXX'
let testStoreConfig = null
let testConversation
let localVue = null
let store = null
let addParticipantOnceAction = null
beforeEach(() => {
localVue = createLocalVue()
localVue.use(Vuex)
testConversation = {
token: testToken,
participantFlags: PARTICIPANT.CALL_FLAG.DISCONNECTED,
participantType: PARTICIPANT.TYPE.USER,
lastPing: 600,
sessionId: 'session-id-1',
attendeeId: 'attendee-id-1',
actorType: ATTENDEE.ACTOR_TYPE.USERS,
actorId: 'actor-id',
}
testStoreConfig = cloneDeep(storeConfig)
addParticipantOnceAction = jest.fn()