Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("should init with collectStatistics(true)", () => {
// Given
const mockGa = ImportMock.mockFunction(ga, "sendEvent");
// When
flickingInfo = createFlicking(horizontal.full, { collectStatistics: true });
mockGa.restore();
// Then
expect(mockGa.callCount).to.be.equals(1);
});
});
import { fireEvent, render } from '@testing-library/react';
import fetchMock from 'fetch-mock';
import React from 'react';
import { act } from 'react-dom/test-utils';
import { ImportMock } from 'ts-mock-imports';
import { DashboardVideoPaneTranscriptOption } from '.';
import * as useTimedTextTrackModule from '../../data/stores/useTimedTextTrack';
import { timedTextMode, uploadState } from '../../types/tracks';
import { Deferred } from '../../utils/tests/Deferred';
import { wrapInIntlProvider } from '../../utils/tests/intl';
const useTimedTextTrackStub = ImportMock.mockFunction(
useTimedTextTrackModule,
'useTimedTextTrack',
);
jest.mock('../../data/appData', () => ({
appData: {},
}));
describe('', () => {
afterEach(jest.resetAllMocks);
afterAll(useTimedTextTrackStub.restore);
const video = {
description: 'Some description',
has_transcript: false,
id: '443',
import { wrapInIntlProvider } from '../../utils/tests/intl';
jest.mock('react-router-dom', () => ({
Redirect: ({ push, to }: { push: boolean; to: string }) =>
`Redirect push to ${to}.`,
}));
jest.mock('../../data/appData', () => ({
appData: {
jwt: 'some token',
},
}));
const mockAddThumbnail = jest.fn();
const useThumbnailStub = ImportMock.mockFunction(
useThumbnailModule,
'useThumbnail',
);
describe('', () => {
afterEach(jest.resetAllMocks);
afterAll(useThumbnailStub.restore);
const video = {
description: '',
has_transcript: false,
id: '43',
is_ready_to_show: true,
show_download: true,
thumbnail: {
jest.mock('jwt-decode', () => jest.fn());
jest.mock('../../utils/isAbrSupported', () => ({
isHlsSupported: jest.fn(),
isMSESupported: jest.fn(),
}));
const mockIsMSESupported = isMSESupported as jestMockOf;
const mockIsHlsSupported = isHlsSupported as jestMockOf;
jest.mock('../../Player/createPlayer', () => ({
createPlayer: jest.fn(),
}));
const mockCreatePlayer = createPlayer as jestMockOf;
const useTimedTextTrackStub = ImportMock.mockFunction(
useTimedTextTrackModule,
'useTimedTextTrack',
);
jest.mock('../../data/appData', () => ({
appData: {
video: {
description: 'Some description',
id: 'video-id',
is_ready_to_show: true,
show_download: false,
thumbnail: null,
timed_text_tracks: [],
title: 'Some title',
upload_state: 'ready',
urls: {