Skip to content

Commit 207bcf8

Browse files
committed
coursework/sprint-3-implement-and-rewrite are done
1 parent 1834231 commit 207bcf8

File tree

6 files changed

+30
-9
lines changed

6 files changed

+30
-9
lines changed

Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ assertEquals(acute, "Acute angle");
6767
// Then the function should return "Obtuse angle"
6868
const obtuse = getAngleType(120);
6969
assertEquals(obtuse, "Obtuse angle");
70-
70+
//
7171
// Case 4: Identify Straight Angles:
7272
// When the angle is exactly 180 degrees,
7373
// Then the function should return "Straight angle"

Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function assertEquals(actualOutput, targetOutput) {
2929
}
3030

3131
// Acceptance criteria:
32-
32+
//
3333
// Proper Fraction check:
3434
// Input: numerator = 2, denominator = 3
3535
// target output: true

Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ assertEquals(tenofDiamonds, 10);
6969
// Given a card with a rank of "J," "Q," or "K",
7070
// When the function is called with such a card,
7171
// Then it should return 10
72+
//
7273
const jackofClubs = getCardValue("J♣");
7374
assertEquals(jackofClubs, 10);
7475

Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ test("should identify right angle (90°)", () => {
77
});
88

99
// Case 2: Identify Acute Angles
10+
//
1011
// When the angle is less than 90 degrees, it should return "Acute angle"
1112
test("should identify acute angle (<90°)", () => {
1213
expect(getAngleType(45)).toEqual("Acute angle");
Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
1-
// This statement loads the isProperFraction function you wrote in the implement directory.
2-
// We will use the same function, but write tests for it using Jest in this file.
31
const isProperFraction = require("../implement/2-is-proper-fraction");
42

5-
test("should return true for a proper fraction", () => {
3+
// Case 1: Proper fraction
4+
test("should return true for a proper fraction (numerator < denominator)", () => {
65
expect(isProperFraction(2, 3)).toEqual(true);
76
});
7+
//
88

9-
// Case 2: Identify Improper Fractions:
9+
// Case 2: Improper fraction
10+
test("should return false for an improper fraction (numerator > denominator)", () => {
11+
expect(isProperFraction(5, 2)).toEqual(false);
12+
});
13+
14+
// Case 3: Negative fraction
15+
test("should return true for a negative proper fraction (numerator < denominator)", () => {
16+
expect(isProperFraction(-4, 7)).toEqual(true);
17+
});
1018

11-
// Case 3: Identify Negative Fractions:
19+
// Case 4: Numerator equal to denominator
20+
test("should return false when numerator equals denominator", () => {
21+
expect(isProperFraction(3, 3)).toEqual(false);
22+
});
1223

13-
// Case 4: Identify Equal Numerator and Denominator:
24+
// Optional: Zero numerator
25+
test("should return true when numerator is zero", () => {
26+
expect(isProperFraction(0, 5)).toEqual(true);
27+
});
28+
29+
// Case 5: Negative denominator
30+
test("should return true when denominator is negative and proper", () => {
31+
expect(isProperFraction(2, -5)).toEqual(true);
32+
});

Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test("should return 10 for face cards J, Q, K", () => {
2828
test("should return 11 for Ace of Hearts", () => {
2929
expect(getCardValue("A♥")).toEqual(11);
3030
});
31-
31+
//
3232
// Case 5: Handle Invalid Cards
3333
// If the card rank is invalid, it should throw an error
3434
test("should throw error for invalid cards", () => {

0 commit comments

Comments
 (0)