-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); |
36 changes: 36 additions & 0 deletions
36
src/components/Projects/WBS/WBSDetail/ImportTask/__tests__/ImportTask.jsx.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |