Fix simple-peer mock
This commit is contained in:
parent
4bdd2e4cae
commit
0075d93879
@ -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
|
|
||||||
14
src/__mocks__/simple-peer.ts
Normal file
14
src/__mocks__/simple-peer.ts
Normal 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
|
||||||
@ -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 NotifyActions from './NotifyActions'
|
||||||
import * as SocketActions from './SocketActions'
|
import * as SocketActions from './SocketActions'
|
||||||
import * as StreamActions from './StreamActions'
|
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 {
|
export interface InitAction {
|
||||||
type: 'INIT'
|
type: 'INIT'
|
||||||
|
|||||||
@ -111,7 +111,7 @@ describe('PeerActions', () => {
|
|||||||
expect(messages[messages.length - 1]).toEqual({
|
expect(messages[messages.length - 1]).toEqual({
|
||||||
userId: 'user2',
|
userId: 'user2',
|
||||||
timestamp: jasmine.any(String),
|
timestamp: jasmine.any(String),
|
||||||
image: null,
|
image: undefined,
|
||||||
message: 'test',
|
message: 'test',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user