Skip to content

Commit

Permalink
test1
Browse files Browse the repository at this point in the history
  • Loading branch information
yuuuno32 committed Feb 3, 2025
1 parent ff1e16b commit fc9fb51
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/actions/__tests__/allTeamsAction.js.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { teamMembersFectchACtion } from '../allTeamsAction';
import { RECEIVE_ALL_USER_TEAMS } from '../../constants/allTeamsConstants';

describe('teamMembersFectchACtion', () => {
it('should create an action to set all user teams', () => {
const payload = [{ id: 1, name: 'Team 1' }, { id: 2, name: 'Team 2' }];
const expectedAction = {
type: RECEIVE_ALL_USER_TEAMS,
payload,
};
expect(teamMembersFectchACtion(payload)).toEqual(expectedAction);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import { render, fireEvent, waitFor } from '@testing-library/react';
import { Provider } from 'react-redux';
import configureStore from 'redux-mock-store';
import ImportTask from '../ImportTask';
import { importTask, getPopupById } from '../../../../../../actions/task';
import { TASK_IMPORT_POPUP_ID } from '../../../../../../constants/popupId';

const mockStore = configureStore([]);
jest.mock('read-excel-file', () => jest.fn(() => Promise.resolve([])));
jest.mock('../../../../../../actions/task', () => ({
importTask: jest.fn(() => ({ type: 'IMPORT_TASK' })),
getPopupById: jest.fn(() => ({ type: 'GET_POPUP_BY_ID' })),
}));

describe('ImportTask Component', () => {
let store;

beforeEach(() => {
store = mockStore({
popupEditor: { currPopup: { popupContent: 'Task PR#905' } },
projectMembers: { members: [] },
theme: { darkMode: false },
});
});

test('renders ImportTask component', () => {
const { getByText } = render(
<Provider store={store}>
<ImportTask />
</Provider>
);

expect(getByText('Import Tasks')).toBeInTheDocument();
});
});

0 comments on commit fc9fb51

Please sign in to comment.