generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 195
London | Emmanuel Gessessew | Module-Structuring-and-Testing-Data | sprint 3| WEEK 3 #185
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
Emmanuelgessessew
wants to merge
18
commits into
CodeYourFuture:main
Choose a base branch
from
Emmanuelgessessew: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 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
46cc0f6
solution to exercise
Emmanuelgessessew cefeea6
editing
Emmanuelgessessew 7b970c1
solving errors
Emmanuelgessessew 2500cf3
interpret exercise
Emmanuelgessessew 3ca4eca
debugging
Emmanuelgessessew 9fdeb38
correcting errors
Emmanuelgessessew cf6eacf
implement solutions
Emmanuelgessessew e1421fd
interpret solutions
Emmanuelgessessew 412c625
editting
Emmanuelgessessew cbc5c15
implementing the getAngleType
Emmanuelgessessew 89df819
implementing is proper function
Emmanuelgessessew 9370614
implementing get card value
Emmanuelgessessew 29d4ef0
changes
Emmanuelgessessew 921b6ce
implementing valid traiangle
Emmanuelgessessew 6f7180b
testing angle type
Emmanuelgessessew 0dd59e4
testing get card values
Emmanuelgessessew b3a66a4
testing propper fructions
Emmanuelgessessew 9d93d0a
changes
Emmanuelgessessew 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,4 @@ function getCardValue(card) { | |
} | ||
|
||
|
||
module.exports = getCardValue; |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
test('should return the numeric value for cards 2 to 9', function() { | ||
for (let card = 2; card <= 9; card++) { | ||
expect(getCardValue(card)).toBe(card); | ||
} | ||
}); | ||
|
||
test('should return 10 for face cards "10", "J", "Q", "K"', function() { | ||
expect(getCardValue("10")).toBe(10); | ||
expect(getCardValue("J")).toBe(10); | ||
expect(getCardValue("Q")).toBe(10); | ||
expect(getCardValue("K")).toBe(10); | ||
}); | ||
|
||
test('should return 11 for the Ace card "A"', function() { | ||
expect(getCardValue("A")).toBe(11); | ||
}); | ||
|
||
test('should throw an error for invalid card types (e.g., "Z")', function() { | ||
expect(() => getCardValue("Z")).toThrow("Invalid card"); | ||
}); | ||
|
||
test('should throw an error for invalid numeric cards (e.g., 1, 0, -3)', function() { | ||
expect(() => getCardValue(1)).toThrow("Invalid card"); | ||
expect(() => getCardValue(0)).toThrow("Invalid card"); | ||
expect(() => getCardValue(-3)).toThrow("Invalid card"); | ||
}); | ||
|
||
test('should throw an error for non-numeric and non-string inputs', function() { | ||
expect(() => getCardValue(null)).toThrow("Invalid card"); | ||
expect(() => getCardValue(undefined)).toThrow("Invalid card"); | ||
expect(() => getCardValue([])).toThrow("Invalid card"); | ||
expect(() => getCardValue({})).toThrow("Invalid card"); | ||
}); |
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.