refactor(frontend): replace legacy action files with TypeScript equivalents

This commit is contained in:
Yiannis
2026-03-11 02:06:59 +02:00
parent e9af15582f
commit 7a5fca6fd8
21 changed files with 173 additions and 243 deletions

View File

@@ -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 ');

View File

@@ -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', () => {

View File

@@ -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', () => {

View File

@@ -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', () => {

View File

@@ -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', () => {

View File

@@ -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', () => {

View File

@@ -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', () => {