mirror of
https://github.com/mediacms-io/mediacms.git
synced 2026-03-22 20:43:10 -04:00
refactor(frontend): replace legacy action files with TypeScript equivalents
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import * as MediaPageActions from '../../../src/static/js/utils/actions/MediaPageActions';
|
||||
import dispatcher from '../../../src/static/js/utils/dispatcher';
|
||||
import { dispatcher } from '../../../src/static/js/utils/dispatcher';
|
||||
|
||||
// Mock the dispatcher module used by MediaPageActions
|
||||
jest.mock('../../../src/static/js/utils/dispatcher', () => ({ dispatch: jest.fn() }));
|
||||
jest.mock('../../../src/static/js/utils/dispatcher', () => ({ dispatcher: { dispatch: jest.fn() } }));
|
||||
|
||||
describe('utils/actions', () => {
|
||||
describe('MediaPageActions', () => {
|
||||
@@ -41,6 +41,12 @@ describe('utils/actions', () => {
|
||||
expect(dispatch).toHaveBeenCalledWith({ type: 'REPORT_MEDIA', reportDescription: '' });
|
||||
});
|
||||
|
||||
it('Should dispatch REPORT_MEDIA with empty string when description is null', () => {
|
||||
MediaPageActions.reportMedia(null);
|
||||
expect(dispatch).toHaveBeenCalledTimes(1);
|
||||
expect(dispatch).toHaveBeenCalledWith({ type: 'REPORT_MEDIA', reportDescription: '' });
|
||||
});
|
||||
|
||||
// @todo: Revisit this behavior
|
||||
it('Should dispatch REPORT_MEDIA with stripped description when provided', () => {
|
||||
MediaPageActions.reportMedia(' some text ');
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as PageActions from '../../../src/static/js/utils/actions/PageActions';
|
||||
import dispatcher from '../../../src/static/js/utils/dispatcher';
|
||||
import { dispatcher } from '../../../src/static/js/utils/dispatcher';
|
||||
|
||||
// Mock the dispatcher module used by PageActions
|
||||
jest.mock('../../../src/static/js/utils/dispatcher', () => ({ dispatch: jest.fn() }));
|
||||
jest.mock('../../../src/static/js/utils/dispatcher', () => ({ dispatcher: { dispatch: jest.fn() } }));
|
||||
|
||||
describe('utils/actions', () => {
|
||||
describe('PageActions', () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { PlaylistPageActions } from '../../../src/static/js/utils/actions';
|
||||
import dispatcher from '../../../src/static/js/utils/dispatcher';
|
||||
import { dispatcher } from '../../../src/static/js/utils/dispatcher';
|
||||
|
||||
// Mock the dispatcher module used by PlaylistPageActions
|
||||
jest.mock('../../../src/static/js/utils/dispatcher', () => ({ dispatch: jest.fn() }));
|
||||
jest.mock('../../../src/static/js/utils/dispatcher', () => ({ dispatcher: { dispatch: jest.fn() } }));
|
||||
|
||||
describe('utils/actions', () => {
|
||||
describe('PlaylistPageActions', () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { PlaylistViewActions } from '../../../src/static/js/utils/actions';
|
||||
import dispatcher from '../../../src/static/js/utils/dispatcher';
|
||||
import { dispatcher } from '../../../src/static/js/utils/dispatcher';
|
||||
|
||||
// Mock the dispatcher module used by PlaylistViewActions
|
||||
jest.mock('../../../src/static/js/utils/dispatcher', () => ({ dispatch: jest.fn() }));
|
||||
jest.mock('../../../src/static/js/utils/dispatcher', () => ({ dispatcher: { dispatch: jest.fn() } }));
|
||||
|
||||
describe('utils/actions', () => {
|
||||
describe('PlaylistViewActions', () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { ProfilePageActions } from '../../../src/static/js/utils/actions';
|
||||
import dispatcher from '../../../src/static/js/utils/dispatcher';
|
||||
import { dispatcher } from '../../../src/static/js/utils/dispatcher';
|
||||
|
||||
// Mock the dispatcher module used by ProfilePageActions
|
||||
jest.mock('../../../src/static/js/utils/dispatcher', () => ({ dispatch: jest.fn() }));
|
||||
jest.mock('../../../src/static/js/utils/actions/../dispatcher', () => ({ dispatcher: { dispatch: jest.fn() } }));
|
||||
|
||||
describe('utils/actions', () => {
|
||||
describe('ProfilePageActions', () => {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { SearchFieldActions } from '../../../src/static/js/utils/actions';
|
||||
import dispatcher from '../../../src/static/js/utils/dispatcher';
|
||||
|
||||
// Mock the dispatcher module used by SearchFieldActions
|
||||
jest.mock('../../../src/static/js/utils/dispatcher', () => ({ dispatch: jest.fn() }));
|
||||
jest.mock('../../../src/static/js/utils/dispatcher', () => ({ dispatcher: { dispatch: jest.fn() } }));
|
||||
|
||||
import { dispatcher } from '../../../src/static/js/utils/dispatcher';
|
||||
|
||||
describe('utils/actions', () => {
|
||||
describe('SearchFieldActions', () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { VideoViewerActions } from '../../../src/static/js/utils/actions';
|
||||
import dispatcher from '../../../src/static/js/utils/dispatcher';
|
||||
import { dispatcher } from '../../../src/static/js/utils/dispatcher';
|
||||
|
||||
// Mock the dispatcher module used by VideoViewerActions
|
||||
jest.mock('../../../src/static/js/utils/dispatcher', () => ({ dispatch: jest.fn() }));
|
||||
jest.mock('../../../src/static/js/utils/dispatcher', () => ({ dispatcher: { dispatch: jest.fn() } }));
|
||||
|
||||
describe('utils/actions', () => {
|
||||
describe('VideoViewerActions', () => {
|
||||
|
||||
Reference in New Issue
Block a user