Skip to content

London | May-2025 | Fatima_Zohra_Belkedari | Module Structuring and Testing Data | Sprint. 3 #629

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
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
696bb42
updating angle type.js
Farah-Stu Jun 27, 2025
4cc5106
fixing the proper fraciton.js
Farah-Stu Jun 27, 2025
22cab74
updating card value
Farah-Stu Jun 28, 2025
ed21e9d
update card value
Farah-Stu Jun 28, 2025
4d9bc3b
update angle type.test
Farah-Stu Jun 28, 2025
8f7c8a6
adding assertEqual line
Farah-Stu Jun 28, 2025
27e36c5
updating proper fraction file
Farah-Stu Jun 29, 2025
a97c923
updating the file
Farah-Stu Jun 29, 2025
cc9d7dc
updating the proper fraction test file
Farah-Stu Jun 29, 2025
bfee299
updating card file
Farah-Stu Jun 29, 2025
8f9221a
updating card test file
Farah-Stu Jun 29, 2025
d6a385f
update count file
Farah-Stu Jun 30, 2025
0c51d93
update count.test.js
Farah-Stu Jun 30, 2025
9c6607c
updating ordinal num file
Farah-Stu Jun 30, 2025
da6f74f
update ordinal num file test
Farah-Stu Jun 30, 2025
b15ce67
update repeat file
Farah-Stu Jun 30, 2025
401a0d1
update repeat test file
Farah-Stu Jun 30, 2025
d25287f
updating and returnig a valid message to the function
Farah-Stu Jul 11, 2025
ea3514b
returning a valid message to the code
Farah-Stu Jul 11, 2025
22db2cc
matching the description in the test file
Farah-Stu Jul 11, 2025
77294d9
updating
Farah-Stu Jul 11, 2025
6c4aa13
updating and testing numbers
Farah-Stu Jul 11, 2025
b0c9c31
updating file.js
Farah-Stu Jul 11, 2025
3000184
updadting the test file
Farah-Stu Jul 11, 2025
96eb260
updating the code
Farah-Stu Jul 12, 2025
19e006e
updating the card value code
Farah-Stu Jul 12, 2025
037bc34
updating the code with invalid card rank
Farah-Stu Jul 12, 2025
535e4ba
updating the file
Farah-Stu Jul 12, 2025
96888f8
updating the. file
Farah-Stu Jul 13, 2025
eece386
updating the file
Farah-Stu Jul 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Sprint-3/2-mandatory-rewrite/1-get-angle-type.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
function getAngleType(angle) {
if (angle<= 0 || angle >= 360) {
return "invalid angle";
}

if (angle === 90) return "Right angle";
// replace with your completed function from key-implement
if (angle < 90) return "Acute angle";
if (angle > 0 && angle < 90) return "Acute angle";
if (angle > 90 && angle < 180) return "Obtuse angle";
if (angle === 180) return "Straight angle";
if (angle > 180 && angle < 360) return "Reflex angle";
}

}



Expand Down
7 changes: 7 additions & 0 deletions Sprint-3/2-mandatory-rewrite/1-get-angle-type.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
const getAngleType = require("./1-get-angle-type");

// Test cases for invalid angles
test("should return invalid angle for angles <=0 or angle >=360", ()=> {
expect(getAngleType(0)).toEqual("invalid angle");
expect(getAngleType(360)).toEqual("invalid angle");
});


test("should identify right angle (90°)", () => {
expect(getAngleType(90)).toEqual("Right angle");
});
Expand Down
3 changes: 1 addition & 2 deletions Sprint-3/2-mandatory-rewrite/3-get-card-value.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
function getCardValue(card) {
const rank = card;

const rank = card.slice(0, -1);
if (rank === "A") return 11;
if (["J", "Q", "K"].includes(rank)) return 10;
const number = Number(rank);
Expand Down
12 changes: 6 additions & 6 deletions Sprint-3/2-mandatory-rewrite/3-get-card-value.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ const getCardValue = require("./3-get-card-value");

// Case 2: Handle Number Cards (2-10):
test("should return number for number cards (2-10)",() => {
expect(getCardValue("2")).toEqual (2);
expect(getCardValue("10")).toEqual(10);
expect(getCardValue("2")).toEqual (2);
expect(getCardValue("10")).toEqual(10);
});
// Case 3: Handle Face Cards (J, Q, K):
test("should return 10 for Jack of Diamonds", () => {
expect(getCardValue ("J")).toEqual(10);
expect(getCardValue ("J")).toEqual(10);
});

test("should return 10 for Queen of Clubs", () => {
expect(getCardValue("Q")).toEqual(10);
expect(getCardValue("Q")).toEqual(10);
});

test("should return 10 for King of Spades", () => {
expect(getCardValue("K")).toEqual(10);
expect(getCardValue("K")).toEqual(10);
});

// Case 4: Handle Ace (A):
test("should return 11 for Ace", () => {
expect(getCardValue("A")).toEqual(11);
expect(getCardValue("A")).toEqual(11);
});

// Case 5: Handle Invalid Cards:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ const getOrdinalNumber = require("./get-ordinal-number");
// When the number is 1,
// Then the function should return "1st"

test("should return '1st' for 1", () => {
test("append 'st' to numbers ending in 1" , () => {
expect(getOrdinalNumber(1)).toEqual("1st");
expect(getOrdinalNumber(21)).toEqual("21st");
expect(getOrdinalNumber(121)).toEqual("121st");
});

test("should return '2nd' for 2", () => {
test("append 'nd' to numbers ending in 2, except those ending in 12", () => {
expect(getOrdinalNumber(2)).toEqual("2nd");
expect(getOrdinalNumber(22)).toEqual("22nd");
expect(getOrdinalNumber(132)).toEqual("132nd");
});

test("should return '23rd' for 23", () => {
test("append 'rd' to numbers ending in 3 , except those ending in 13", () => {
expect(getOrdinalNumber(23)).toEqual("23rd");
expect(getOrdinalNumber(13)).toEqual("13th");
Copy link
Contributor

Choose a reason for hiding this comment

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

"except those ending in 13".

Numbers ending in 12, and 13 could be placed together with numbers ending in 11 in the same category.

expect(getOrdinalNumber(3)).toEqual("3rd");
});

test("should return '11th' for 11", () => {
Expand Down
2 changes: 1 addition & 1 deletion Sprint-3/3-mandatory-practice/implement/repeat.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test("should return a target string when count equals 1", () => {
// Given a target string str and a count equal to 0,
// When the repeat function is called with these inputs,
// Then it should return an empty string, ensuring that a count of 0 results in an empty output.
test("should return target string when count equals 0", () => {
test("should return empt string when count equals 0", () => {
const str = "hello";
const count = 0;
const repeatedStr = repeat(str, count);
Expand Down