Skip to content

Commit

Permalink
Merge pull request #2013 from OneCommunityGlobal/Nahiyan_Optimize-Pro…
Browse files Browse the repository at this point in the history
…ject-Report-Page

Nahiyan_Added a "Edit Tasks" button to reduce the number of requests
  • Loading branch information
one-community authored Jul 9, 2024
2 parents eca8974 + 3cb8060 commit fe996e1
Show file tree
Hide file tree
Showing 11 changed files with 452 additions and 355 deletions.
20 changes: 18 additions & 2 deletions src/__tests__/TaskTable/Selectors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('get_task_by_wbsId', () => {
};
const WbsTasksID = ['A','B'];
const result = get_task_by_wbsId(WbsTasksID, mockTasks);
expect(result).toEqual([{ id: 2, wbsId: 'B' }]);
expect(result).toEqual([ { id: 1, wbsId: 'A' }, { id: 3, wbsId: 'A' }, { id: 2, wbsId: 'B' } ]);
});

it('returns the correct tasks based on WbsTasksID', () => {
Expand All @@ -26,7 +26,23 @@ describe('get_task_by_wbsId', () => {
};
const WbsTasksID = ['A'];
const result = get_task_by_wbsId(WbsTasksID, mockTasks);
expect(result).toEqual(undefined);
console.log("RESULT: ");
console.log(result)
expect(result).toEqual([{"id": 1, "wbsId": "A"}, {"id": 3, "wbsId": "A"}]);
});

it('returns an empty array when WbsTasksID is not found', () => {
const mockTasks = {
fetched: true,
taskItems: [
{ id: 1, wbsId: 'A' },
{ id: 2, wbsId: 'B' },
{ id: 3, wbsId: 'A' }
]
};
const WbsTasksID = ['C']; // WbsTasksID not found
const result = get_task_by_wbsId(WbsTasksID, mockTasks);
expect(result).toEqual([]);
});
});

2 changes: 1 addition & 1 deletion src/__tests__/TaskTable/TasksTable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('TasksTable component', () => {

const renderComponent = () => render(
<Provider store={store}>
<TasksTable WbsTasksID={['someId']} />
<TasksTable tasks={[]} />
</Provider>
);

Expand Down
Loading

0 comments on commit fe996e1

Please sign in to comment.