generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 195
Glasgow | May-2025 | Salah Ahmed| Sprint-3 #634
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
avatarit
wants to merge
64
commits into
CodeYourFuture:main
Choose a base branch
from
avatarit: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.
+4,130
−78
Open
Changes from 53 commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
41faaac
have done my key-implement exercise
Millena28 fb392b3
done the mandatory-rewrite
Millena28 52148a6
Done the mandatory-practice
Millena28 4d0497e
Done stretch investigate and implemented new card-validator file
Millena28 13220cd
done ALL
Millena28 396094b
made some corrections from review
Millena28 f3b70e8
Merge branch 'CodeYourFuture:coursework/sprint-3' into coursework/spr…
avatarit 8ca4e8e
Implement angle type identification in getAngleType function
avatarit a9c9341
Remove placeholder comments for missing tests in getAngleType function
avatarit b1b2078
Refactor getAngleType function for improved readability and consistency
avatarit 78e3a52
Add assertions for zero numerator check in isProperFraction function
avatarit c75235c
Fix formatting inconsistencies in angle type assertions for clarity
avatarit 39aad2d
Refactor getCardValue function to improve card rank extraction and va…
avatarit 0d2e786
Refactor getAngleType function to streamline angle classification logic
avatarit ef3385f
Refactor getCardValue function for improved clarity and error handling
avatarit f381483
Update package-lock.json to reflect changes in package names and vers…
avatarit 49bcbfe
Refactor isProperFraction function and update tests for accuracy
avatarit 5774458
Remove unnecessary files: package.json, readme.md, and image assets
avatarit 9226863
Add tests for getCardValue function to validate card value retrieval …
avatarit e8bdd72
Add getCardValue function to retrieve card values with error handling
avatarit 03fd47d
Add tests for getAngleType function to validate angle identification
avatarit 61cdb3e
Implement getAngleType function with angle classification and corresp…
avatarit 41d94fc
Implement isProperFraction function with comprehensive test cases
avatarit 0f70f77
Implement isProperFraction function to evaluate proper fractions
avatarit 830b5e4
Refactor code structure for improved readability and maintainability
avatarit b500e15
Fix the code of get angle
avatarit e931299
Remove unnecessary blank line in isProperFraction.js
avatarit 315ab1a
fixed the code issue
avatarit aae7d84
Remove unnecessary blank line at the beginning of get-card-value.js
avatarit 2fd86de
Refactor angle type function to improve clarity and return default va…
avatarit c693e17
Refactor angle type tests for clarity by removing redundant comments
avatarit 4330f25
fix the issue in the code
avatarit d92d35c
Update isProperFraction test file
avatarit c45f222
Refactor getCardValue function for improved readability by adjusting …
avatarit 388622f
Refactor test cases for getCardValue function by reorganizing comment…
avatarit 51997e1
Update countChar function
avatarit 88e292d
Fix formatting of comment in count.test.js for consistency
avatarit 7829d7e
Refactor getOrdinalNumber function for improved readability by adjust…
avatarit e924d5d
update ordinal-number.test.js for improved readability
avatarit 475029a
Fix formatting
avatarit 65bcde5
implement the code
avatarit fef80b8
Refactor isValidCreditCard function for improved readability and cons…
avatarit 9549f29
The questions have been answerd
avatarit 97d365f
fix passwordValidator function
avatarit 35c9171
update the file
avatarit 5677d8b
Refactor angle type identification tests for clarity and consistency;…
avatarit ec1de20
Refactor isProperFraction function for improved logic and to handle z…
avatarit 11f25a5
Fix invalid card rank test case variable name for consistency
avatarit a9d379c
Add test case for handling unknown angles in angle type identification
avatarit d2b2de9
Refactor isProperFraction function for improved logic and update test…
avatarit c571045
Add tests for negative numbers, non-integer inputs, and zero in getOr…
avatarit 4f777e0
Implement repeat function with input validation and update tests for …
avatarit 749afc7
Remove redundant Ace test cases for different suits in getCardValue t…
avatarit 5ff8087
Refactor password validator and update tests for clarity and accuracy
avatarit dc7f375
Fix error message for negative count in repeat function and update co…
avatarit 2c6495f
Fixed the issues
avatarit 508e086
Delete package.json
avatarit c38f34c
Fixed the comments
avatarit 6d0daca
json file
avatarit b657e8d
fix: restore package files to match base branch
avatarit 4e1cb4a
Removes trailing newline from extensions configuration
avatarit 22bc718
remove json files from PR
avatarit 9d595c7
Merge branch 'CodeYourFuture:main' into coursework/sprint-3
avatarit 5477c7a
Delete .github/FUNDING.yml
avatarit 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 was deleted.
Oops, something went wrong.
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
avatarit marked this conversation as resolved.
Show resolved
Hide resolved
|
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
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. This is a good set of tests. I would recommend adding a test for "Unknown angle type" since this is a part of your getAngleType function. |
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
avatarit marked this conversation as resolved.
Show resolved
Hide resolved
|
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,11 +1,57 @@ | ||
const isProperFraction = require("./2-is-proper-fraction"); | ||
|
||
// Test cases for isProperFraction function | ||
// Case 1: Identify Proper Fractions: | ||
// When the numerator is less than the denominator, | ||
// Then the function should return true indicating a proper fraction. | ||
test("should return true for a proper fraction", () => { | ||
expect(isProperFraction(2, 3)).toEqual(true); | ||
}); | ||
|
||
// Case 2: Identify Improper Fractions: | ||
test("should return false for an improper fraction", () => { | ||
expect(isProperFraction(5, 2)).toEqual(false); | ||
}); | ||
|
||
// Case 3: Identify Negative Fractions: | ||
// Case 2: Identify Zero Numerator: | ||
test("should return true for a zero numerator", () => { | ||
expect(isProperFraction(0, 5)).toEqual(true); | ||
}); | ||
|
||
// Case 4: Identify Equal Numerator and Denominator: | ||
// Case 3: Identify Negative proper Fractions: | ||
|
||
test("should return false for a negative improper fraction", () => { | ||
avatarit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
expect(isProperFraction(-3, -4)).toEqual(true); | ||
}); | ||
|
||
// Case 4: Identify Negative Improper Fractions: | ||
test("should return true for a negative proper fraction", () => { | ||
avatarit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
expect(isProperFraction(-5, -3)).toEqual(false); | ||
}); | ||
|
||
// Case 5: Identify Equal Numerator and Denominator: | ||
test("should return false for equal numerator and denominator", () => { | ||
expect(isProperFraction(5,5)).toEqual(false); | ||
}); | ||
|
||
// Case 6: Identify Zero Denominator: | ||
test("should return false for zero denominator", () => { | ||
expect(isProperFraction(5, 0)).toEqual(false); | ||
}); | ||
|
||
// Case 7: Identify Negative Denominator: | ||
test("should return true for a negative denominator", () => { | ||
expect(isProperFraction(3, -4)).toEqual(true); | ||
}); | ||
|
||
// Case 8: invalid input: | ||
test("should return false for invalid input", () => { | ||
expect(isProperFraction("a", 3)).toEqual(false); | ||
expect(isProperFraction(2, "b")).toEqual(false); | ||
expect(isProperFraction("c", "d")).toEqual(false); | ||
}); | ||
|
||
// Case 9: empty input: | ||
test("should return false for empty input", () => { | ||
expect(isProperFraction()).toEqual(false); | ||
expect(isProperFraction("", "")).toEqual(false); | ||
}); |
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,17 @@ | ||
|
||
function getCardValue(card) { | ||
// replace with your code from key-implement | ||
return 11; | ||
} | ||
if (!card || typeof card !== "string") return "Invalid card format"; | ||
//extracting the rank of the card | ||
const rank = card.slice(0, -1); | ||
|
||
//parseInt(rank) and Number(rank) are the same thing. parseInt() is a function that parses a string and returns an integer. If the first character in the string can't be converted into a number, then it returns NaN. Number() is a function that converts a string to a number. If the string can't be converted into a number, then it returns NaN. | ||
if (rank === "A") return 11; | ||
//For numerical cards, we return the number | ||
else if (Number(rank) >= 2 && Number(rank) <= 10) return Number(rank); | ||
//For face cards, we return 10 | ||
else if ( rank === "J" || rank=== "Q" || rank ==="K" ) return 10; | ||
//If the card is invalid, we throw an error | ||
else return("Invalid card rank."); | ||
} | ||
|
||
module.exports = getCardValue; |
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.
Can you remove this file from your PR? It may have been added by mistake. Once your PR has been created, it's a good habit to review the files and ensure that only the required files are included! :)