generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
LONDON | Pooriya Ketabi | Module-Structuring-and-Testing-Data | Sprint 3 #230
Open
PooriyaKTB
wants to merge
8
commits into
CodeYourFuture:main
Choose a base branch
from
PooriyaKTB:sprint-3-task
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
8 commits
Select commit
Hold shift + click to select a range
c5fa34c
implement get-angle-type.js done
PooriyaKTB a09d789
get-card-value.js Done
PooriyaKTB a5ecab6
is-proper-fraction.js Done
PooriyaKTB 380cd2b
is-valid-triangle.js Done
PooriyaKTB bffd6d9
rotate-char.js Done
PooriyaKTB fd1dbe5
implement/get-card-value.js Changed
PooriyaKTB 51d4637
implement/is-proper-fraction.js Changed
PooriyaKTB c004901
Unnecessary directory Removed
PooriyaKTB 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const getCardValue = require("./get-card-value"); | ||
test("should return the correct value for number cards (2-10)", () => { | ||
expect(getCardValue("2♠")).toBe(2); | ||
expect(getCardValue("9♥")).toBe(9); | ||
expect(getCardValue("10♦")).toBe(10); | ||
}); | ||
|
||
test("should return 10 for face cards (J, Q, K)", () => { | ||
expect(getCardValue("J♠")).toBe(10); | ||
expect(getCardValue("Q♣")).toBe(10); | ||
expect(getCardValue("K♦")).toBe(10); | ||
}); | ||
|
||
test("should return 11 for an Ace (A)", () => { | ||
expect(getCardValue("A♠")).toBe(11); | ||
}); | ||
|
||
test("should throw an error for an invalid card rank", () => { | ||
expect(() => getCardValue("Z♠")).toThrow("Invalid card rank"); | ||
}); |
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 @@ | ||
const isValidTriangle = require("./is-valid-triangle"); | ||
|
||
test("should return true for a valid triangle", () => { | ||
expect(isValidTriangle(3, 4, 5)).toBe(true); | ||
expect(isValidTriangle(5, 5, 5)).toBe(true); | ||
expect(isValidTriangle(8, 10, 6)).toBe(true); | ||
}); | ||
|
||
test("should return true for sides 2, 2, 3", () => { | ||
expect(isValidTriangle(2, 2, 3)).toBe(true); | ||
}); | ||
|
||
test("should return false (violates inequality)", () => { | ||
expect(isValidTriangle(1, 2, 3)).toBe(false); | ||
}); | ||
|
||
test("should return false as one side length is 0", () => { | ||
expect(isValidTriangle(0, 5, 7)).toBe(false); | ||
}); | ||
|
||
test("should return false as one side has negative length", () => { | ||
expect(isValidTriangle(3, -4, 5)).toBe(false); | ||
}); | ||
|
||
test("should return false (violates inequality)", () => { | ||
expect(isValidTriangle(5, 1, 1)).toBe(false); | ||
expect(isValidTriangle(1, 1, 2)).toBe(false); | ||
}); |
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.
It's useful to differentiate variable names when you have two things which have the same (but for some reason different, e.g. a different type type) data in them.
I probably wouldn't use
parseIntRank
as a variable name -parse
is a verb, and verbs suggest doing (i.e. function names).What do you think of each of these variable name pairs?
rankString
andrankNumber
rankAsString
andrankAsNumber
stringRank
andnumericRank
rankString
andrank