generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 260
Birmingham | 25-ITP-Sep | Hadi-Vahidi | Sprint 3 |sprint-3-implement-and-rewrite #804
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
Closed
HadiVahidi20
wants to merge
17
commits into
CodeYourFuture:main
from
HadiVahidi20:coursework/sprint-3-implement-and-rewrite
Closed
Changes from 3 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
1189fcd
Add age calculation functionality and HTML structure for age input
HadiVahidi20 78b6a33
Refactor age calculator layout and improve form structure
HadiVahidi20 ea977e5
addWnetListener Example added
HadiVahidi20 22c0fee
Refactor age calculator layout and improve form structure
HadiVahidi20 c346f52
percentage exersice added
HadiVahidi20 ea0fca9
Enhance percentage exercise layout and add area calculation functiona…
HadiVahidi20 cfb55de
Implement getAngleType function with all angle cases and tests
HadiVahidi20 6937b06
Implement isProperFraction function with basic tests
HadiVahidi20 ac30244
exercise 3 is done
HadiVahidi20 7ce4235
Add Jest tests for getAngleType function
HadiVahidi20 54e91ad
added jest test for 2-is-proper-faction
HadiVahidi20 f3203bb
added jest test for3-get-card-value
HadiVahidi20 b823e9c
all sprint 3 implement task are done.
HadiVahidi20 36c74ca
the proper function is now correct
HadiVahidi20 fd49b18
the proper fraction test is corrected
HadiVahidi20 09eec6d
simplify getCardValue tests using categorical approach
HadiVahidi20 7dd99dd
Fix isProperFraction to handle negative denominators correctly by add…
HadiVahidi20 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
46 changes: 21 additions & 25 deletions
46
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js
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 |
|---|---|---|
| @@ -1,31 +1,27 @@ | ||
| // This statement loads the getCardValue function you wrote in the implement directory. | ||
| // We will use the same function, but write tests for it using Jest in this file. | ||
| const getCardValue = require("../implement/3-get-card-value"); | ||
|
|
||
| test("should return 11 for Ace of Spades", () => { | ||
| const aceofSpades = getCardValue("A♠"); | ||
| expect(aceofSpades).toEqual(11); | ||
| // Case 1: Handle Number Cards (2-10) | ||
| test("should return the value of number cards (2-10)", () => { | ||
| expect(getCardValue("2♣")).toEqual(2); | ||
| expect(getCardValue("5♥")).toEqual(5); | ||
| expect(getCardValue("10♦")).toEqual(10); | ||
| }); | ||
|
|
||
| // Case 2: Handle Number Cards (2-10): | ||
| test ("should return a 5 for the card with rank of 5 like(5♥) ",()=>{ | ||
| const fiveofHearts = getCardValue("5♥"); | ||
| expect(fiveofHearts).toEqual(5); | ||
| // Case 2: Handle Face Cards (J, Q, K) | ||
| test("should return 10 for face cards (J, Q, K)", () => { | ||
| expect(getCardValue("J♠")).toEqual(10); | ||
| expect(getCardValue("Q♣")).toEqual(10); | ||
| expect(getCardValue("K♦")).toEqual(10); | ||
| }); | ||
|
|
||
| // Case 3: Handle Ace (A) | ||
| test("should return 11 for Ace cards", () => { | ||
| expect(getCardValue("A♠")).toEqual(11); | ||
| expect(getCardValue("A♣")).toEqual(11); | ||
| }); | ||
|
|
||
| }) | ||
| // Case 3: Handle Face Cards (J, Q, K): | ||
| test("shoild return 10 fore the faced cart like king(K♦) and queen (Q♣)") | ||
| const kingCard =getCardValue("K♦"); | ||
| const queenCard= getCardValue("Q♣"); | ||
| expect(kingCard).toEqual(10); | ||
| expect (queenCard).toEqual(10); | ||
| // Case 4: Handle Ace (A): | ||
| test("should return 11 for Ace of Spades", () => { | ||
| const aceofSpades = getCardValue("A♣"); | ||
| expect(aceofSpades).toEqual(11); | ||
| // Case 4: Handle Invalid Cards | ||
| test("should return 'Invalid card rank.' for invalid cards", () => { | ||
| expect(getCardValue("z♣")).toEqual("Invalid card rank."); | ||
| expect(getCardValue("11♠")).toEqual("Invalid card rank."); | ||
| }); | ||
| // Case 5: Handle Invalid Cards: | ||
| test ("should return invalid card rank for invalid inputs like(z♣)",()=>{ | ||
| const invalidCard= getCardValue("z♣"); | ||
| expect(invalidCard).toEqual("Invalid card rank."); | ||
| }); |
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.
In math, 2/-3 is equal to -2/3, and -2/-3 = 2/3.
So ideally
isProperFraction(2, -3)andisProperFraction(-2, -3)should alsotrue.Suggestion: Look up the definition of proper fraction.