Fix CallActions.test.ts
This commit is contained in:
parent
9db349d4a5
commit
720e26a5dd
@ -74,6 +74,8 @@ describe('CallActions', () => {
|
||||
message: 'Connected to server socket',
|
||||
type: 'warning',
|
||||
},
|
||||
}, {
|
||||
type: constants.INIT,
|
||||
}, {
|
||||
type: constants.NOTIFY,
|
||||
payload: {
|
||||
|
||||
@ -19,15 +19,18 @@ const initialize = (): InitializeAction => ({
|
||||
|
||||
export const init = (): ThunkResult<Promise<void>> =>
|
||||
async (dispatch, getState) => {
|
||||
socket.on('connect', () => {
|
||||
dispatch(NotifyActions.warning('Connected to server socket'))
|
||||
dispatch(SocketActions.handshake({
|
||||
socket,
|
||||
roomName: callId,
|
||||
}))
|
||||
dispatch(initialize())
|
||||
})
|
||||
socket.on('disconnect', () => {
|
||||
dispatch(NotifyActions.error('Server socket disconnected'))
|
||||
return new Promise(resolve => {
|
||||
socket.on('connect', () => {
|
||||
dispatch(NotifyActions.warning('Connected to server socket'))
|
||||
dispatch(SocketActions.handshake({
|
||||
socket,
|
||||
roomName: callId,
|
||||
}))
|
||||
dispatch(initialize())
|
||||
resolve()
|
||||
})
|
||||
socket.on('disconnect', () => {
|
||||
dispatch(NotifyActions.error('Server socket disconnected'))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user