generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 336
London | 26-ITP-Jan | Ebrahim Moqbel | Sprint 3 | Implement and Rewrite Tests #1194
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
Open
Ebrahim-Moqbel
wants to merge
7
commits into
CodeYourFuture:main
Choose a base branch
from
Ebrahim-Moqbel:coursework/sprint-3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9eed6df
completed the implement exercise
Ebrahim-Moqbel 49b88ad
rewrote test with jest
Ebrahim-Moqbel 3c92b48
fixed the logic error or the two return value in the finction a
Ebrahim-Moqbel bfb2769
I met the expectation of the error behaviour outcome which is Error i…
Ebrahim-Moqbel 34ae0f2
Fixed the logic bug( a misplced parenthesis
Ebrahim-Moqbel 5237b54
I catagrised the error messages and made them consistent
Ebrahim-Moqbel e75c8ba
matched the Error messages in the test cases with the function error …
Ebrahim-Moqbel 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -11,8 +11,23 @@ test(`Should return 11 when given an ace card`, () => { | |
|
|
||
| // Suggestion: Group the remaining test data into these categories: | ||
| // Number Cards (2-10) | ||
| test(`Should return the correct value for number cards (2-10)`, () => { | ||
| expect(getCardValue("2♠")).toEqual(2); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test call here looks slightly mis-structured, the callback function appears to be outside the test(...) call. |
||
| expect(getCardValue("5♠")).toEqual(5); | ||
| expect(getCardValue("10♠")).toEqual(10); | ||
| }) | ||
| // Face Cards (J, Q, K) | ||
| test(`Should return 10 when given a face card (J, Q, K)`, () => { | ||
| expect(getCardValue("J♠")).toEqual(10); | ||
| expect(getCardValue("Q♠")).toEqual(10); | ||
| expect(getCardValue("K♠")).toEqual(10); | ||
| }) | ||
| // Invalid Cards | ||
| test(`Should throw an error when given an invalid card`, () => { | ||
| expect(() => getCardValue("5X")).toThrow("Invalid card ")}); //invalid suit | ||
| expect(() => getCardValue("1♠")).toThrow("Invalid card "); //invalid rank | ||
| expect(() => getCardValue("3")).toThrow("Invalid card "); //missing suit | ||
| }) | ||
|
|
||
| // To learn how to test whether a function throws an error as expected in Jest, | ||
| // please refer to the Jest documentation: | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.