36 lines
908 B
JavaScript
36 lines
908 B
JavaScript
/* eslint-disable no-undef */
|
|
import fetch from 'node-fetch';
|
|
import { TextEncoder, TextDecoder } from 'util';
|
|
import { PeerConnectionMock, SessionDescriptionMock, IceCandidateMock } from './test/mocks/peerconnectionmock.js';
|
|
import ResizeObserverMock from './test/helpers/resizeobservermock.js';
|
|
|
|
// 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;
|
|
}
|