Skip to content

Conversation

Bluejay600
Copy link

@Bluejay600 Bluejay600 commented Jul 11, 2025

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Sprint-3 is mainly about implementing, rewriting, practicing and and testing functions.

Questions

Ask any questions you have for your reviewer.

2. identified obtuse angle and it's function
3. identified stright angle and it's function
4. identified reflex anglewith it's function.
2. Identified Obtuse angles when it's greater than 90 degrees and less than 180, and added a line to test the function.
3. added a line to test all the if conditions in the program.
2. tested other scenarios like Zero numerator
@Bluejay600 Bluejay600 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Jul 22, 2025
const rank = card.slice(0, -1); // Get the rank (everything except the last character)
if (rank === "A") return 11;
if (["J", "Q", "K"].includes(rank)) return 10;
if (rank >= "2" && rank <= "9") return parseInt(rank, 10);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the function is not returning what you expect, that means your test or/and the function are incorrect and should be updated accordingly.

Comment on lines 4 to 8
test("should return 5 for 5 of Hearts", () => {
const fiveofHearts = getCardValue("5♥");
expect(fiveofHearts).toEqual(5);
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also apply the change if you recognise the suggested approach is better?

Comment on lines 10 to 21
test("should return 10 for Jack of Diamonds", () => {
const jackOfDiamonds = getCardValue("J♦");
expect(jackOfDiamonds).toEqual(10);
});
test("should return 10 for Queen of Clubs", () => {
const queenOfClubs = getCardValue("Q♣");
expect(queenOfClubs).toEqual(10);
});
test("should return 10 for King of Spades", () => {
const kingOfSpades = getCardValue("K♠");
expect(kingOfSpades).toEqual(10);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any change in this file since I last reviewed it. Did you forget to commit your changes or push them to Github?

Comment on lines 1 to 10
function countChar(stringOfCharacters, findCharacter) {
// Initialize a counter
let count = 0;

// Scenario: Multiple Occurrences
// Given the input string str,
// And a character char that may occur multiple times with overlaps within str (e.g., 'a' in 'aaaaa'),
// When the function is called with these inputs,
// Then it should correctly count overlapping occurrences of char (e.g., 'a' appears five times in 'aaaaa').
// Loop through the string
for (let char of stringOfCharacters) {
if (char === findCharacter) {
count++;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can import the function from count.js as
const countChar = require("./count");

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 22, 2025
2. Added all required checks according to your criteria.
3. Used the allowed special characters only: !, #, $, %, ., *, &.
2. edited the rank to be (2_9) only to ensures only one-digit numeric strings are parsed.
…works too, but toBe() is stricter).

2. Added a test for "10" card (which sometimes causes issues if not handled early).
3.  Added extra invalid card checks ("" and "10" without suit) to catch edge cases.
4. Included "A♠" for completeness under the Ace tests.
@Bluejay600 Bluejay600 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Jul 25, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the changes look good. Good job.

Comment on lines +3 to +10
// Case 1: Handle Ace (A)
test("should return 11 for Ace of Spades", () => {
const aceofSpades = getCardValue("A♠");
expect(aceofSpades).toEqual(11);
});

// Case 2: Handle Number Cards (2-10):
// Case 3: Handle Face Cards (J, Q, K):
// Case 4: Handle Ace (A):
// Case 5: Handle Invalid Cards:
expect(getCardValue("A♠")).toBe(11);
});

test("should return 11 for Ace of Diamonds", () => {
expect(getCardValue("A♦")).toBe(11);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you set up two tests for Ace when the function is not expected to check the suit?

});

test("should return 10 for 10 of Clubs", () => {
expect(getCardValue("10♣")).toBe(10);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change toEqual() to toBe()?

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants