generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 197
West Midlands | MAY | EMIN AKTURK | Sprint 3 | MODULE-STRUCTURING-AND-TESTING-DATA #692
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
eminakturk
wants to merge
29
commits into
CodeYourFuture:main
Choose a base branch
from
eminakturk:coursework/sprint3
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
29 commits
Select commit
Hold shift + click to select a range
84e3bca
First 3 exercises of sprint 1 are completed.
eminakturk 3c9fb3a
Key exercise part is done with this commit
eminakturk c882576
Mandatory errors 0 and 1.js is solved.
eminakturk 8ccf3b2
Mandatory-errors part is finished.
eminakturk d0c0bd7
until time format is finished.
eminakturk 721fe57
finishing touch
eminakturk 3eff2ca
get-angle-type is sorted.
eminakturk 0de42f1
proper fraction sorted.
eminakturk 5d8d05c
get card value sorted.
eminakturk 7fe2790
sprint3 coursework done.
eminakturk fed3a0c
Merge branch 'main' into coursework/sprint3
eminakturk 16e88b9
Delete Sprint-1/1-key-exercises/1-count.js
eminakturk 17f9a99
Delete Sprint-1/1-key-exercises/2-initials.js
eminakturk 4266d77
Delete Sprint-1/1-key-exercises/3-paths.js
eminakturk 05564df
Delete Sprint-1/1-key-exercises/4-random.js
eminakturk a932cb1
Delete Sprint-1/2-mandatory-errors/0.js
eminakturk 2c47ed9
Delete Sprint-1/2-mandatory-errors/1.js
eminakturk 1b7c8c7
Delete Sprint-1/2-mandatory-errors/2.js
eminakturk c95381e
Delete Sprint-1/2-mandatory-errors/3.js
eminakturk 1fd0b02
Delete Sprint-1/2-mandatory-errors/4.js
eminakturk 71b7003
Delete Sprint-1/3-mandatory-interpret/1-percentage-change.js
eminakturk 0c7b105
Delete Sprint-1/3-mandatory-interpret/2-time-format.js
eminakturk 97d27ed
Delete Sprint-1/3-mandatory-interpret/3-to-pounds.js
eminakturk 47d5d46
the errors mentioned are fixed.
eminakturk 2f97455
Merge branch 'coursework/sprint3' of https://github.com/eminakturk/Mo…
eminakturk 29d0ece
Merge branch 'main' into coursework/sprint3
eminakturk 315d99a
latest error fix.
eminakturk d31e82f
Merge branch 'coursework/sprint3' of https://github.com/eminakturk/Mo…
eminakturk cf78bda
fixes back to deleted files.
eminakturk 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,13 @@ | ||
function isProperFraction(numerator, denominator) { | ||
if (numerator < denominator) return true; | ||
// add your completed function from key-implement here | ||
if (denominator === 0) { | ||
return false; | ||
} | ||
|
||
if (Math.abs(numerator) < Math.abs(denominator)) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
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,13 @@ | ||
function getCardValue(card) { | ||
// replace with your code from key-implement | ||
return 11; | ||
if (!card || card.length < 2) { | ||
throw new Error("Invalid card rank."); | ||
} | ||
|
||
const rank = card.slice(0, -1); | ||
if (rank === "A") return 11; | ||
if (rank === "J" || rank === "Q" || rank === "K" || rank === "10") return 10; | ||
if (!isNaN(rank) && Number(rank) >= 2 && Number(rank) <= 9) return Number(rank); | ||
throw new Error("Invalid card rank."); | ||
} | ||
module.exports = getCardValue; | ||
|
||
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 |
---|---|---|
|
@@ -3,9 +3,38 @@ const getCardValue = require("./3-get-card-value"); | |
test("should return 11 for Ace of Spades", () => { | ||
const aceofSpades = getCardValue("A♠"); | ||
expect(aceofSpades).toEqual(11); | ||
}); | ||
}); | ||
|
||
// Case 2: Handle Number Cards (2-10): | ||
test("should return correct number for number cards", () => { | ||
expect(getCardValue("5♥")).toEqual(5); | ||
expect(getCardValue("10♦")).toEqual(10); | ||
}); | ||
|
||
// Case 3: 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 4: Handle Ace (A): | ||
// (Already tested above with Ace of Spades) | ||
|
||
// Case 5: Handle Invalid Cards: | ||
test("should throw error for invalid cards", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you review the test at line 25? The assertion fails. |
||
expect(() => getCardValue("Z♠")).toThrow("Invalid card rank."); | ||
expect(() => getCardValue("1♠")).toThrow("Invalid card rank."); | ||
}); | ||
|
||
test("should throw error for multi-digit number (other than 10)", () => { | ||
expect(() => getCardValue("345♠")).toThrow("Invalid card rank."); | ||
}); | ||
|
||
test("should throw error for only suit (no rank)", () => { | ||
expect(() => getCardValue("♠")).toThrow("Invalid card rank."); | ||
}); | ||
|
||
test("should throw error for numbers out of range", () => { | ||
expect(() => getCardValue("100♠")).toThrow("Invalid card rank."); | ||
}); |
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,9 @@ | ||
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; |
Oops, something went wrong.
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.
I suggest adding tests for these edge cases: