Skip to content

Commit 9b453d8

Browse files
committed
Add assertions for testing. Fix formatting
1 parent d643752 commit 9b453d8

1 file changed

Lines changed: 35 additions & 6 deletions

File tree

‎Sprint-3/3-mandatory-implement/3-to-pounds.js‎

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,40 @@ function toPounds(penceString) {
2121
.substring(paddedPenceNumberString.length - 2)
2222
.padEnd(2, "0");
2323

24-
return(`£${pounds}.${pence}`);
24+
return `£${pounds}.${pence}`;
2525
}
2626

27-
toPounds("10p");
28-
toPounds("100p");
29-
toPounds("232134p");
30-
toPounds("238p");
31-
toPounds("5234p");
27+
const currentOutput1 = toPounds("10p");
28+
const targetOutput1 = "£0.10";
29+
console.assert(
30+
currentOutput1 === targetOutput1,
31+
`current output: ${currentOutput1}, target output: ${targetOutput1};`,
32+
);
33+
34+
const currentOutput2 = toPounds("100p");
35+
const targetOutput2 = "£1.00";
36+
console.assert(
37+
currentOutput2 === targetOutput2,
38+
`current output: ${currentOutput2}, target output: ${targetOutput2};`,
39+
);
40+
41+
const currentOutput3 = toPounds("232134p");
42+
const targetOutput3 = "£2321.34";
43+
console.assert(
44+
currentOutput3 === targetOutput3,
45+
`current output: ${currentOutput3}, target output: ${targetOutput3};`,
46+
);
47+
48+
const currentOutput4 = toPounds("238p");
49+
const targetOutput4 = "£2.38";
50+
console.assert(
51+
currentOutput4 === targetOutput4,
52+
`current output: ${currentOutput4}, target output: ${targetOutput4};`,
53+
);
54+
55+
const currentOutput5 = toPounds("5234p");
56+
const targetOutput5 = "£52.34";
57+
console.assert(
58+
currentOutput5 === targetOutput5,
59+
`current output: ${currentOutput5}, target output: ${targetOutput5};`,
60+
);

0 commit comments

Comments
 (0)