-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chal 16 #27
Merged
Merged
Chal 16 #27
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
23de7a2
CHAL-16: Fixed page height
noreen1423 337f2c5
CHAL-16: Fixed page height
noreen1423 65844e3
final update
noreen1423 d6a6185
Merge remote-tracking branch 'upstream/development' into CHAL-16
noreen1423 db205cd
removed the page container test
noreen1423 96538ad
Adding take challenge button
noreen1423 a66d405
Resolved merge conflicts
noreen1423 f2490ae
Take the Challenge styled correctly, and added test
noreen1423 feb1808
removed line 5 queryAllByRole
noreen1423 39eb8c2
Merge remote-tracking branch 'upstream/development' into CHAL-16
noreen1423 550f0db
Removed unused data-testid prop from PageContainer and updated snapshots
noreen1423 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { | ||
render, | ||
screen, | ||
cleanup, | ||
} from '@testing-library/react'; | ||
import userEvent, { type UserEvent } from '@testing-library/user-event'; | ||
import { mockDialogMethods } from '@/utils/test/mock-dialog-methods'; | ||
import navigation from 'next/navigation'; | ||
import { Builder } from 'builder-pattern'; | ||
import Home from '@/app/page'; | ||
import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime'; | ||
|
||
jest.mock('next/navigation', () => ({ | ||
useRouter: jest.fn(), | ||
})); | ||
|
||
describe('Home Page', () => { | ||
mockDialogMethods(); | ||
let router: AppRouterInstance; | ||
let user: UserEvent; | ||
|
||
beforeEach(() => { | ||
user = userEvent.setup(); | ||
router = Builder<AppRouterInstance>() | ||
.push(jest.fn()) | ||
.prefetch(jest.fn()) | ||
.build(); | ||
jest.spyOn(navigation, 'useRouter').mockImplementation(() => router); | ||
}); | ||
|
||
afterEach(cleanup); | ||
|
||
it('navigates to /challengerwelcome when the challenge button is clicked.', async () => { | ||
render(<Home />); | ||
const challengeButtons = screen.getAllByRole('button', { | ||
name: /Take the Challenge/i, | ||
}); | ||
for (const button of challengeButtons) { | ||
await user.click(button); | ||
} | ||
expect(router.push).toHaveBeenCalledTimes(2); | ||
expect(router.push).toHaveBeenNthCalledWith(1, '/challengerwelcome'); | ||
expect(router.push).toHaveBeenNthCalledWith(2, '/challengerwelcome'); | ||
}); | ||
}); |
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
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 |
---|---|---|
|
@@ -71,9 +71,6 @@ | |
} | ||
|
||
.challenge_btn { | ||
@extend .btn_gradient; | ||
@extend .btn_lg; | ||
@extend .btn_wide; | ||
margin: 50px 0; | ||
} | ||
|
||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove data-testid here as it is unused.