-
-
Notifications
You must be signed in to change notification settings - Fork 398
London | 26-ITP-May | Jorvan White | Sprint 3 | Implement and Rewrite Tests #1601
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
JorvanW
wants to merge
34
commits into
CodeYourFuture:main
Choose a base branch
from
JorvanW:Sprint-3/1-implement-and-rewrite-tests
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
34 commits
Select commit
Hold shift + click to select a range
4c62400
updated 1-count.js with an explanation of line 3
JorvanW 376a6b0
added answers to 0.js
2323e10
Added notes for 1.js
87fbee5
added notes for 2.js
57e3a65
added notes to 0.js
bf5c332
added answer to 0.js
4ca3f91
added notes to 1.js
185c7e7
added answers to 2.js
195189a
completed. 1-bmi
3f957a1
Answered the questions for 2-cases.js
b48031e
Added answers to the questions in the time-format.js file.
216221a
Created code for 1-get-angle-type.js
d10fc3c
fixed error in 'get-angle-types' and changed "let" to "function".
60638b4
wrote code for "is-proper-fraction" function and added test cases for it
2ac2702
Added code for 1-get-angle-type.test.js to include a test case for ea…
f8cf7cf
added code to test 2-is-proper-fraction.test.js
f3f69db
Add count function and tests
f6f3d1d
Remove CLI-Treasure-Hunt subproject from Sprint-2
0bdef75
Add functions and test for get-ordinal-number.js
630c502
removed unnecessary code and simplified it in excersie-1.js
55740a4
Removed dead code in exercise-2
6994606
Added code for repeat-string .js
e54bbd5
added code for 3-get-card-value.js
9aaaa7e
added tests for 3-get-card-value.test.js
7cacfb4
added notes for 3-get-card-value.js
a6131ab
updated formatting errors in 1-get-angle-types and 2-is-proper-faction
a85a823
updated code and added tests for repeat.str
cc958de
removed code from Sprint-2
919dba4
removed line of code from sprint -1
6e8feda
Updated sprint for PR
d9b6d56
added 4 more test cases for 1-get-angle-type-test
e20bb70
changed code to use math.abs in 2-is-proper-fraction
a41e976
updated code and test cases for 2-is-proper-fraction
836cce7
added more test cases for 3-get-card-value
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
|
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. there should be more negative number test cases. Can you think of them? |
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 |
|---|---|---|
|
|
@@ -10,11 +10,62 @@ test(`Should return 11 when given an ace card`, () => { | |
| }); | ||
|
|
||
| // Suggestion: Group the remaining test data into these categories: | ||
| // Number Cards (2-10) | ||
| // Face Cards (J, Q, K) | ||
|
|
||
| // Case 2: Number Cards (2-10) | ||
| test(`Should return the same number when given a number card of any suit`, () => { | ||
| expect(getCardValue("3♠")).toEqual(3); | ||
| expect(getCardValue("5♥")).toEqual(5); | ||
| expect(getCardValue("9♦")).toEqual(9); | ||
| expect(getCardValue("10♣")).toEqual(10); | ||
| }); | ||
|
|
||
| // Case 3: Valid Suits | ||
| test("Should accept all valid suits", () => { | ||
| expect(getCardValue("A♠")).toEqual(11); | ||
| expect(getCardValue("A♥")).toEqual(11); | ||
| expect(getCardValue("A♦")).toEqual(11); | ||
| expect(getCardValue("A♣")).toEqual(11); | ||
| }); | ||
|
|
||
| // Case 4: Face Cards (J, Q, K) | ||
| test(`Should return 10 when given an any face card`, () => { | ||
| expect(getCardValue("J♠")).toEqual(10); | ||
| expect(getCardValue("Q♥")).toEqual(10); | ||
| expect(getCardValue("K♦")).toEqual(10); | ||
| }); | ||
|
|
||
| // Invalid Cards | ||
|
|
||
| // Test 5: Non-suit inputs | ||
| test("Cards without suits throw an error", () => { | ||
| expect(() => { | ||
| getCardValue("10"); | ||
| }).toThrow("Invalid card"); | ||
| }); | ||
|
Comment on lines
+37
to
+44
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. there should be more invalid cases, Can you think of them? |
||
|
|
||
| // Test 6: Invalid suits | ||
| test("Should throw an error for an invalid suit", () => { | ||
| expect(() => getCardValue("A★")).toThrow("Invalid card"); | ||
| }); | ||
|
|
||
| // Test 7: Invalid rank | ||
| test("Should throw an error for an invalid rank", () => { | ||
| expect(() => getCardValue("Z♠")).toThrow("Invalid card"); | ||
| }); | ||
|
|
||
| // Test 8: Invalid input | ||
| test("Should throw an error for an invalid card", () => { | ||
| expect(() => getCardValue("hello")).toThrow("Invalid card"); | ||
| }); | ||
|
|
||
| // Test 9: Reject lowercase card ranks | ||
| test("Should reject lowercase card ranks", () => { | ||
| expect(() => getCardValue("a♠")).toThrow("Invalid card"); | ||
| expect(() => getCardValue("j♠")).toThrow("Invalid card"); | ||
| expect(() => getCardValue("q♠")).toThrow("Invalid card"); | ||
| expect(() => getCardValue("k♠")).toThrow("Invalid card"); | ||
| }); | ||
|
|
||
| // To learn how to test whether a function throws an error as expected in Jest, | ||
| // please refer to the Jest documentation: | ||
| // https://jestjs.io/docs/expect#tothrowerror | ||
|
|
||
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.
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.
Besides
-1and361, it should include the two boundary cases as well.