generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 197
London | 25-ITP-May | Hendrine Zeraua | Sprint 3 | Structuring and Testing Data #661
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
rarityXtreme
wants to merge
25
commits into
CodeYourFuture:main
Choose a base branch
from
rarityXtreme: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 20 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
6661734
Implement getAngleType function with unit tests for all angle cases
rarityXtreme ec17037
Add isProperFraction function and assertions for valid, invalid, and …
rarityXtreme d009f8c
Implement getCardValue function with tests
rarityXtreme 9d54264
added completed getAngleType function from Key-implement exercise
rarityXtreme 9f0f339
Add Jest tests for getAngleType function
rarityXtreme 313cab7
add isProperFraction from key- Implement
rarityXtreme 511f37e
Add edge case tests for isProperFraction function
rarityXtreme 0dbe430
add function getCardValue from key-implement
rarityXtreme 3c1595e
Add tests for getCardValue including edge cases and errors
rarityXtreme 4f1c3fc
Implement countChar function
rarityXtreme ded4991
add test cases for countChar function
rarityXtreme 18f5c89
implement getOrdinalNumber with suffix rules
rarityXtreme 9865786
add test cases for getOrdinalNumber including exceptions
rarityXtreme d8530a7
implement repeat function with validation
rarityXtreme 5a453cc
add test cases for repeat function including edge cases
rarityXtreme 74254e9
implement credit card validator function
rarityXtreme a93be32
add Jest tests for credit card validator
rarityXtreme ea002b3
add while loop character finder with explanatory comments
rarityXtreme ceb0b9d
add passwordValidator function with full rule checks
rarityXtreme 63ac7a2
add test cases for passwordValidator function
rarityXtreme 927294c
amend getAngleType function to handle invalid inputs and improve test…
rarityXtreme 7981a13
tightened card rank checks and added edge case tests
rarityXtreme b077682
group ordinal number tests by suffix categories for full coverage
rarityXtreme 35f5500
group valid credit card tests into a single case
rarityXtreme b6b8a27
clarify ordinal test description for numbers ending in 0 or 4–9
rarityXtreme 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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
|
||
function isProperFraction(numerator, denominator) { | ||
if (numerator < denominator) return true; | ||
// add your completed function from key-implement here | ||
} | ||
if (denominator === 0) return false; | ||
return Math.abs(numerator) < Math.abs(denominator); | ||
} | ||
|
||
|
||
module.exports = isProperFraction; |
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 |
---|---|---|
@@ -1,5 +1,18 @@ | ||
|
||
function getCardValue(card) { | ||
// replace with your code from key-implement | ||
return 11; | ||
} | ||
const rank = card.slice(0, -1); | ||
|
||
if (rank === "A") return 11; | ||
|
||
const numericRank = parseInt(rank); | ||
if (!isNaN(numericRank) && numericRank >= 2 && numericRank <= 10) { | ||
return numericRank; | ||
} | ||
cjyuan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if (["J", "Q", "K"].includes(rank)) { | ||
return 10; | ||
} | ||
|
||
throw new Error("Invalid card rank."); | ||
} | ||
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
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,5 +1,16 @@ | ||
function countChar(stringOfCharacters, findCharacter) { | ||
return 5 | ||
} | ||
// The test should fail because the current function always returns 5. | ||
// function countChar(stringOfCharacters, findCharacter) { | ||
// return 5 | ||
// } | ||
|
||
module.exports = countChar; | ||
// module.exports = countChar; | ||
// Here the placeholder(5) is replaced to implement the function to pass the tests | ||
function countChar(stringOfCharacters, findCharacter) { | ||
let count = 0; | ||
for (let char of stringOfCharacters) { | ||
if (char === findCharacter) count++; | ||
} | ||
return count; | ||
} | ||
|
||
module.exports = countChar; |
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
25 changes: 21 additions & 4 deletions
25
Sprint-3/3-mandatory-practice/implement/get-ordinal-number.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,5 +1,22 @@ | ||
function getOrdinalNumber(num) { | ||
return "1st"; | ||
} | ||
// function getOrdinalNumber(num) { | ||
// return "1st"; | ||
// } | ||
|
||
// module.exports = getOrdinalNumber; | ||
|
||
module.exports = getOrdinalNumber; | ||
function getOrdinalNumber(num) { | ||
const lastTwo = num % 100; | ||
const lastDigit = num % 10; | ||
|
||
if (lastTwo >= 11 && lastTwo <= 13) { | ||
return `${num}th`; | ||
} | ||
|
||
if (lastDigit === 1) return `${num}st`; | ||
if (lastDigit === 2) return `${num}nd`; | ||
if (lastDigit === 3) return `${num}rd`; | ||
|
||
return `${num}th`; | ||
} | ||
|
||
module.exports = getOrdinalNumber; |
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.