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