generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 195
Sheffield| May 2025| Mayowa Fadare| Structure testing sprint 3 #633
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
mayowa0-7
wants to merge
11
commits into
CodeYourFuture:main
Choose a base branch
from
mayowa0-7:Structure-testing-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 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3b13a90
completed the code to pass the remaining angles
mayowa0-7 cd2d9f1
fraction code testdone
mayowa0-7 b3bfd4b
made changes to the card values
mayowa0-7 eb25c34
using the template, i made some corrections to the mandatory-rewrite
mayowa0-7 52cc4a3
mandatory practice done
mayowa0-7 339c2ba
made changes to validate the card
mayowa0-7 14c036b
created a new file for card validator and ran the code
mayowa0-7 c7ccd98
card validator cheked and passed using npx
mayowa0-7 5981bd2
run, tested and passed npx test
mayowa0-7 989265d
all tested and passed the jest test
mayowa0-7 d465d6a
card value function fixed
mayowa0-7 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
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,11 @@ | ||
|
||
function isProperFraction(numerator, denominator) { | ||
if (numerator < denominator) return true; | ||
// add your completed function from key-implement here | ||
// Check for invalid fraction (denominator cannot be zero) | ||
if (denominator === 0) { | ||
return false; | ||
} | ||
// Check if the absolute value of the numerator is less than the absolute value of the denominator | ||
return Math.abs(numerator) < Math.abs(denominator); | ||
} | ||
|
||
module.exports = isProperFraction; | ||
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,15 @@ | ||
function getCardValue(card) { | ||
// replace with your code from key-implement | ||
return 11; | ||
const rank = card.slice(0, -1); // strip off the suit emoji | ||
|
||
if (rank === "A") return 11; | ||
if (["K", "Q", "J", "10"].includes(rank)) return 10; | ||
|
||
const number = parseInt(rank); | ||
if (!isNaN(number) && number >= 2 && number <= 9) { | ||
return number; | ||
} | ||
|
||
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,11 @@ | ||
function countChar(stringOfCharacters, findCharacter) { | ||
return 5 | ||
let count = 0; | ||
for (let char of stringOfCharacters) { | ||
if (char === findCharacter) { | ||
count++; | ||
} | ||
} | ||
return count; | ||
} | ||
|
||
module.exports = countChar; | ||
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
5 changes: 0 additions & 5 deletions
5
Sprint-3/3-mandatory-practice/implement/get-ordinal-number.js
This file was deleted.
Oops, something went wrong.
36 changes: 29 additions & 7 deletions
36
Sprint-3/3-mandatory-practice/implement/get-ordinal-number.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,13 +1,35 @@ | ||
const getOrdinalNumber = require("./get-ordinal-number"); | ||
// In this week's prep, we started implementing getOrdinalNumber | ||
|
||
// continue testing and implementing getOrdinalNumber for additional cases | ||
// Write your tests using Jest - remember to run your tests often for continual feedback | ||
|
||
// Case 1: Identify the ordinal number for 1 | ||
// When the number is 1, | ||
// Then the function should return "1st" | ||
const getOrdinalNumber = require("./getOrdinalNumber"); | ||
|
||
test("should return '1st' for 1", () => { | ||
expect(getOrdinalNumber(1)).toEqual("1st"); | ||
}); | ||
test("returns 1st for 1", () => { | ||
expect(getOrdinalNumber(1)).toBe("1st"); | ||
}); | ||
|
||
test("returns 2nd for 2", () => { | ||
expect(getOrdinalNumber(2)).toBe("2nd"); | ||
}); | ||
|
||
test("returns 3rd for 3", () => { | ||
expect(getOrdinalNumber(3)).toBe("3rd"); | ||
}); | ||
|
||
test("returns 4th for 4", () => { | ||
expect(getOrdinalNumber(4)).toBe("4th"); | ||
}); | ||
|
||
test("Handle the special case for teens (11, 12, 13)", () => { | ||
expect(getOrdinalNumber(11)).toBe("11th"); | ||
expect(getOrdinalNumber(12)).toBe("12th"); | ||
expect(getOrdinalNumber(13)).toBe("13th"); | ||
}); | ||
|
||
test("Get the last digit to determine suffix", () => { | ||
expect(getOrdinalNumber(21)).toBe("21st"); | ||
expect(getOrdinalNumber(22)).toBe("22nd"); | ||
expect(getOrdinalNumber(23)).toBe("23rd"); | ||
expect(getOrdinalNumber(101)).toBe("101st"); | ||
}); |
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.
Does your function return the value you expected from each of the following function calls?
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.
Have you checked if the above function calls can return the expected value?