Skip to content

Commit 9737d08

Browse files
committed
Format all files with prettier
1 parent fafb4c4 commit 9737d08

8 files changed

Lines changed: 26 additions & 29 deletions

File tree

‎implement-and-rewrite-tests/implement-tests-with-node-test/1-get-angle-type.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ test("Classifies reflex angle 359 degrees", () => {
5454
test("Classifies invalid angle 360 degrees", () => {
5555
const invalid = getAngleType(360);
5656
assert.equal(invalid, "Invalid angle");
57-
});
57+
});

‎implement-and-rewrite-tests/implement-tests-with-node-test/2-is-proper-fraction.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ test("Negative proper fraction", () => {
2525

2626
test("Negative improper fraction", () => {
2727
assert.equal(isProperFraction(-8, 5), false);
28-
});
28+
});

‎implement-and-rewrite-tests/implement-tests-with-node-test/3-get-card-value.test.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ test("Valid single-digit card", () => {
1010
});
1111

1212
test("Arbitrary non-card string", () => {
13-
assert.throws(() => getCardValue("invalid"), /Expected a number followed by a suit, but got "invalid"/, "Expected clear error");
13+
assert.throws(
14+
() => getCardValue("invalid"),
15+
/Expected a number followed by a suit, but got "invalid"/,
16+
"Expected clear error"
17+
);
1418
});
1519

1620
// TODO: What other invalid card cases can you think of?
@@ -83,4 +87,4 @@ test("Valid card '10♣'", () => {
8387

8488
test("Valid card 'K♠'", () => {
8589
assert.equal(getCardValue("K♠"), 10);
86-
});
90+
});

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,17 @@
1717
// execute the code to ensure all tests pass.
1818

1919
export function getAngleType(angle) {
20-
21-
if (angle > 0 && angle < 90){
20+
if (angle > 0 && angle < 90) {
2221
return "Acute angle";
23-
} else if (angle === 90){
22+
} else if (angle === 90) {
2423
return "Right angle";
25-
} else if (angle > 90 && angle < 180){
26-
return "Obtuse angle"
27-
} else if (angle === 180){
24+
} else if (angle > 90 && angle < 180) {
25+
return "Obtuse angle";
26+
} else if (angle === 180) {
2827
return "Straight angle";
29-
} else if (angle > 180 && angle < 360){
28+
} else if (angle > 180 && angle < 360) {
3029
return "Reflex angle";
3130
} else {
3231
return "Invalid angle";
3332
}
34-
3533
}

‎implement-and-rewrite-tests/implement/2-is-proper-fraction.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
// execute the code to ensure all tests pass.
1515

1616
export function isProperFraction(numerator, denominator) {
17-
1817
const fraction = Math.abs(numerator / denominator);
1918

20-
if (fraction >= 0 && fraction < 1){
19+
if (fraction >= 0 && fraction < 1) {
2120
return true;
2221
}
2322

2423
return false;
25-
}
24+
}

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,30 @@
2626
export function getCardValue(card) {
2727
const suitString = "♠♥♦♣";
2828
const rankString = "JQK";
29-
30-
if (card){
29+
30+
if (card) {
3131
const suit = card[card.length - 1];
32-
if (suitString.includes(suit)){
33-
const rank = card.slice(0,-1)
34-
if (rank === "10"){
32+
if (suitString.includes(suit)) {
33+
const rank = card.slice(0, -1);
34+
if (rank === "10") {
3535
return 10;
36-
37-
} else if (rank.length === 1){
38-
39-
if (rank === "A"){
36+
} else if (rank.length === 1) {
37+
if (rank === "A") {
4038
return 11;
4139
}
4240

43-
if (rankString.includes(rank)){
41+
if (rankString.includes(rank)) {
4442
return 10;
4543
}
4644

4745
const rankNum = Number(rank);
4846

49-
if (rankNum >= 2){
47+
if (rankNum >= 2) {
5048
return rankNum;
5149
}
5250
}
5351
}
5452
}
5553

5654
throw new Error(`/Expected a number followed by a suit, but got "${card}"/`);
57-
5855
}

‎implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ test(`should return true when 0 and 5 is passed`, () => {
3333

3434
test(`should return true when 3 and -7 is passed`, () => {
3535
expect(isProperFraction(3, -7)).toEqual(true);
36-
});
36+
});

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,3 @@ test(`Should throw error when given 'Q'`, () => {
7777
// To learn how to test whether a function throws an error as expected in Jest,
7878
// please refer to the Jest documentation:
7979
// https://jestjs.io/docs/expect#tothrowerror
80-

0 commit comments

Comments
 (0)