111
This commit is contained in:
35
WebApp/client/jest.setup.js
Normal file
35
WebApp/client/jest.setup.js
Normal file
@@ -0,0 +1,35 @@
|
||||
/* eslint-disable no-undef */
|
||||
import fetch from 'node-fetch';
|
||||
import { TextEncoder, TextDecoder } from 'util';
|
||||
import { PeerConnectionMock, SessionDescriptionMock, IceCandidateMock } from './test/peerconnectionmock';
|
||||
import ResizeObserverMock from './test/resizeobservermock';
|
||||
|
||||
// note: If set testEnvironment `jest-environment-jsdom`, below classes are not defined.
|
||||
|
||||
if (!window.fetch) {
|
||||
window.fetch = fetch;
|
||||
}
|
||||
|
||||
if (!window.TextEncoder) {
|
||||
window.TextEncoder = TextEncoder;
|
||||
}
|
||||
|
||||
if (!window.TextDecoder) {
|
||||
window.TextDecoder = TextDecoder;
|
||||
}
|
||||
|
||||
if (!window.RTCPeerConnection) {
|
||||
window.RTCPeerConnection = PeerConnectionMock;
|
||||
}
|
||||
|
||||
if (!window.RTCSessionDescription) {
|
||||
window.RTCSessionDescription = SessionDescriptionMock;
|
||||
}
|
||||
|
||||
if (!window.RTCIceCandidate) {
|
||||
window.RTCIceCandidate = IceCandidateMock;
|
||||
}
|
||||
|
||||
if (!window.ResizeObserver) {
|
||||
window.ResizeObserver = ResizeObserverMock;
|
||||
}
|
||||
Reference in New Issue
Block a user