Skip to content

Commit ebad589

Browse files
committed
final touch format document for all file in implement
1 parent 2163ec2 commit ebad589

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ function getAngleType(angle) {
1616
return "Obtuse angle";
1717
} else if (angle === 180) {
1818
return "Straight angle";
19-
}
20-
else {
19+
} else {
2120
return "Reflex angle";
2221
}
2322

24-
2523
// Run the tests, work out what Case 2 is testing, and implement the required code here.
2624
// Then keep going for the other cases, one at a time.
2725
}
@@ -74,5 +72,5 @@ assertEquals(straight, "Straight angle");
7472
// When the angle is greater than 180 degrees and less than 360 degrees,
7573
// Then the function should return "Reflex angle"
7674
// ====> write your test here, and then add a line to pass the test in the function above
77-
const reflex=getAngleType(240);
78-
assertEquals(reflex,"Reflex angle");
75+
const reflex = getAngleType(240);
76+
assertEquals(reflex, "Reflex angle");

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

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,19 @@
88
// write one test at a time, and make it pass, build your solution up methodically
99
// just make one change at a time -- don't rush -- programmers are deep and careful thinkers
1010
function getCardValue(card) {
11-
const rank=card.slice(0,-1);
11+
const rank = card.slice(0, -1);
1212
if (rank === "A") {
1313
return 11;
1414
}
15-
if(rank==="J" || rank==="Q" || rank==="K")
16-
{
15+
if (rank === "J" || rank === "Q" || rank === "K") {
1716
return 10;
1817
}
19-
const convertTheStringtoNumber=Number(rank);
20-
if (convertTheStringtoNumber>=2 && convertTheStringtoNumber<=10){
21-
return convertTheStringtoNumber;
22-
}
23-
else
24-
{
25-
return "Invalid card rank";
26-
}
18+
const convertTheStringtoNumber = Number(rank);
19+
if (convertTheStringtoNumber >= 2 && convertTheStringtoNumber <= 10) {
20+
return convertTheStringtoNumber;
21+
} else {
22+
return "Invalid card rank";
23+
}
2724
}
2825
// The line below allows us to load the getCardValue function into tests in other files.
2926
// This will be useful in the "rewrite tests with jest" step.
@@ -52,17 +49,17 @@ assertEquals(aceofSpades, 11);
5249
// Then it should return the numeric value corresponding to the rank (e.g., "5" should return 5).
5350
const fiveofHearts = getCardValue("5♥");
5451
// ====> write your test here, and then add a line to pass the test in the function above
55-
assertEquals(fiveofHearts,5);
52+
assertEquals(fiveofHearts, 5);
5653
// Handle Face Cards (J, Q, K):
5754
// Given a card with a rank of "10," "J," "Q," or "K",
5855
// When the function is called with such a card,
5956
// Then it should return the value 10, as these cards are worth 10 points each in blackjack.
6057
const jackofHearts = getCardValue("J♥");
61-
assertEquals(jackofHearts,10);
58+
assertEquals(jackofHearts, 10);
6259
const queenofSpades = getCardValue("Q♠");
63-
assertEquals(queenofSpades,10);
60+
assertEquals(queenofSpades, 10);
6461
const kingofSpades = getCardValue("K♠");
65-
assertEquals(kingofSpades,10);
62+
assertEquals(kingofSpades, 10);
6663
// Handle Ace (A):
6764
// Given a card with a rank of "A",
6865
// When the function is called with an Ace,
@@ -74,4 +71,4 @@ assertEquals(aceofHearts, 11);
7471
// When the function is called with such a card,
7572
// Then it should throw an error indicating "Invalid card rank."
7673
const invalidCards = getCardValue("B♥");
77-
assertEquals(invalidCards, "Invalid card rank");
74+
assertEquals(invalidCards, "Invalid card rank");

0 commit comments

Comments
 (0)