generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1247 from Real-Dev-Squad/develop
Dev to Main Sync
- Loading branch information
Showing
33 changed files
with
991 additions
and
1,552 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
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
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
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
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,28 @@ | ||
import { render, screen, fireEvent } from '@testing-library/react'; | ||
import { TaskDates } from '@/components/taskDetails/TaskDates'; | ||
|
||
const mockSetNewEndOnDate = jest.fn(); | ||
const mockHandleBlurOfEndsOn = jest.fn(); | ||
|
||
describe('TaskDates Component', () => { | ||
it('should render input field for End On date when in editing mode', () => { | ||
render( | ||
<TaskDates | ||
isEditing={true} | ||
isUserAuthorized={true} | ||
startedOn="2024-03-30T11:20:00Z" | ||
endsOn={1700000000} | ||
newEndOnDate="2024-03-30" | ||
setNewEndOnDate={mockSetNewEndOnDate} | ||
handleBlurOfEndsOn={mockHandleBlurOfEndsOn} | ||
isExtensionRequestPending={false} | ||
taskId="1" | ||
/> | ||
); | ||
|
||
const input = screen.getByTestId('endsOnTaskDetails'); | ||
expect(input).toBeInTheDocument(); | ||
fireEvent.blur(input); | ||
expect(mockHandleBlurOfEndsOn).toHaveBeenCalled(); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
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,55 @@ | ||
import { render, screen, fireEvent } from '@testing-library/react'; | ||
import { TaskDescription } from '@/components/taskDetails/TaskDescription'; | ||
|
||
const mockHandleChange = jest.fn(); | ||
|
||
describe('TaskDescription Component', () => { | ||
it('should renders the task description when not editing', () => { | ||
render( | ||
<TaskDescription | ||
isEditing={false} | ||
purpose="Test Purpose" | ||
handleChange={mockHandleChange} | ||
/> | ||
); | ||
expect(screen.getByText('Test Purpose')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should renders "No description available" when purpose is empty', () => { | ||
render( | ||
<TaskDescription | ||
isEditing={false} | ||
purpose="" | ||
handleChange={mockHandleChange} | ||
/> | ||
); | ||
expect( | ||
screen.getByText('No description available') | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
it('should renders textarea when in editing mode', () => { | ||
render( | ||
<TaskDescription | ||
isEditing={true} | ||
purpose="Test Purpose" | ||
handleChange={mockHandleChange} | ||
/> | ||
); | ||
expect(screen.getByTestId('purpose-textarea')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should calls handleChange when textarea value changes', () => { | ||
render( | ||
<TaskDescription | ||
isEditing={true} | ||
purpose="Test Purpose" | ||
handleChange={mockHandleChange} | ||
/> | ||
); | ||
fireEvent.change(screen.getByTestId('purpose-textarea'), { | ||
target: { value: 'New Purpose' }, | ||
}); | ||
expect(mockHandleChange).toHaveBeenCalled(); | ||
}); | ||
}); |
Oops, something went wrong.