Fix simple-peer mock

This commit is contained in:
Jerko Steiner 2019-11-13 21:34:14 -03:00
parent 4bdd2e4cae
commit 0075d93879
4 changed files with 19 additions and 18 deletions

View File

@ -1,12 +0,0 @@
/* eslint-disable */
import EventEmitter from 'events'
const Peer = jest.fn().mockImplementation(() => {
const peer = new EventEmitter()
peer.destroy = jest.fn()
peer.signal = jest.fn()
peer.send = jest.fn()
Peer.instances.push(peer)
return peer
})
Peer.instances = []
export default Peer

View File

@ -0,0 +1,14 @@
/* eslint-disable */
import EventEmitter from 'events'
const Peer = jest.fn().mockImplementation(() => {
const peer = new EventEmitter();
(peer as any).destroy = jest.fn();
(peer as any).signal = jest.fn();
(peer as any).send = jest.fn();
(Peer as any).instances.push(peer)
return peer
});
(Peer as any).instances = []
export default Peer

View File

@ -1,11 +1,10 @@
import * as constants from '../constants'
import socket from '../socket'
import { Dispatch, ThunkResult } from '../store'
import { callId, getUserMedia } from '../window'
import * as NotifyActions from './NotifyActions'
import * as SocketActions from './SocketActions'
import * as StreamActions from './StreamActions'
import * as constants from '../constants'
import socket from '../socket'
import { callId, getUserMedia } from '../window'
import { Dispatch, GetState, ThunkResult } from '../store'
import { makeAction } from '../async'
export interface InitAction {
type: 'INIT'

View File

@ -111,7 +111,7 @@ describe('PeerActions', () => {
expect(messages[messages.length - 1]).toEqual({
userId: 'user2',
timestamp: jasmine.any(String),
image: null,
image: undefined,
message: 'test',
})
})