Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
301ea63
List edge cases for test.
Sep 28, 2026
2501561
Update list.
Sep 28, 2026
63e477b
Add an if condition to check midnight
Sep 28, 2026
a8e1b2d
Add another case to test midnight
Sep 28, 2026
9e2cef8
Add test case 00:01 to 12:01 am
Sep 28, 2026
2ba2e34
Add condition for checking midday 12 pm
Sep 28, 2026
06d5f91
Add test case for 01:00 to 01:00 am
Sep 28, 2026
3dc6da6
Add test case for 11:59 to 11:59 am
Sep 28, 2026
1e6cb55
Add test case for 12:01 to 12:01 pm
Sep 28, 2026
61b2ce7
Add test case for 13:00 to 1:00 pm
Sep 28, 2026
0407869
Add test case fo 23:59 to 11:59 pm
Sep 28, 2026
06d3f9a
Add padStart method to hours
Sep 28, 2026
598f744
Add more description.
Sep 28, 2026
e6fde3b
Add padStart method to convert 23:00 to 01:00pm
Sep 29, 2026
c2f743c
Edit comments
Sep 29, 2026
e7ff9c7
Inline code directly into return statement
Sep 30, 2026
751fb78
Change am and pm to lower case and update description.
Sep 30, 2026
4707f5a
Unreachable code.
Sep 30, 2026
f504687
Remove unreachable and redundant code.
Sep 30, 2026
d9197c4
Remove unused code
Sep 30, 2026
9494c3d
Update function to work for any input.
Sep 30, 2026
582699c
Format code with prettier.
Sep 30, 2026
b806b41
Stop tracking files
Oct 3, 2026
fcf27e7
Stop tracking files
Oct 3, 2026
04f544f
Restore files unrelated to this PR
Oct 3, 2026
4815e87
Add if condition for checking right angle.
Oct 3, 2026
9dc9e1f
Write test for Acute angle.
Oct 3, 2026
10b0d0f
Write test for Obtuse angle.
Oct 3, 2026
cccf002
Add if condition for checking Acute angle.
Oct 3, 2026
ed2729e
Add if condition for checking Obtuse angle.
Oct 3, 2026
4fa3e6c
Write test for invalid angles
Oct 3, 2026
ea5fa0f
Add final if condition for checking invalid angle
Oct 3, 2026
6102a89
Add boundary case test for acute angle.
Oct 4, 2026
717584d
Add if condition for checking invalid inputs.
Oct 4, 2026
fed8ddd
Add boundary test cases for multiple angles.
Oct 4, 2026
bb815ef
Add = operator for checking 360 degrees is included
Oct 4, 2026
c8fc9dd
Add boundary test cases.
Oct 5, 2026
3a565e9
Add angle type boundary tests
Oct 5, 2026
c80ed87
Add angle type boundary tests
Oct 5, 2026
38c28b3
Implement if condition to check propr function.
Oct 5, 2026
f12c635
Delete not needed test.
Oct 6, 2026
48b8dae
Write cases for testing proper and improper fractions.
Oct 6, 2026
d5091de
Update tests description.
Oct 6, 2026
fa07e40
Implement if condition to check card value
Oct 7, 2026
71c6ea1
Write to test 0 occurrence of a character.
russom-g Oct 13, 2026
c12bed8
Implement function to check character occurrence in a string.
russom-g Oct 13, 2026
1b777bf
Refactor code.
russom-g Oct 13, 2026
5d29d04
Update test description.
russom-g Oct 13, 2026
63905f0
Write test case for numbers ending with 2
russom-g Oct 14, 2026
be0c56e
Write test cases for testing numbers ending with 2.
russom-g Oct 14, 2026
f05ab1d
Write test cases for testing numbers ending with 3.
russom-g Oct 14, 2026
d6e7d06
Write test cases for numbers ending with rd and th.
russom-g Oct 14, 2026
2431fdf
Update test description.
russom-g Oct 14, 2026
7421372
Implement a function for checking ordinal numbers and their suffixes.
russom-g Oct 14, 2026
51a7234
Refactor test cases.
russom-g Oct 14, 2026
7465a37
Write test case for repeating 1 times
russom-g Oct 15, 2026
b5ed6ae
Write test case for repeating 0 times.
russom-g Oct 15, 2026
d363d13
Write test case for repeating -1 times.
russom-g Oct 15, 2026
bd5de48
Implement function that repeats string a number of times.
russom-g Oct 16, 2026
616bbbf
Write test case to test negative input.
russom-g Oct 16, 2026
2de2d40
Remove exercise folders from repo
russom-g Oct 16, 2026
05f3e6e
Restore files to state before removal
russom-g Oct 16, 2026
ba2ebd0
Restore practice-tdd work and remove files from other branches
russom-g Oct 16, 2026
52f6943
Write test case to test for upper case in the password.
russom-g Oct 20, 2026
f950077
Implement if condition for checking A-Z and 0-9
russom-g Oct 20, 2026
0c5efc1
Write test case to test for lower case in the password.
russom-g Oct 20, 2026
3e016dc
Add extra condition for checking for lowercase.
russom-g Oct 20, 2026
8cde26f
Write test. case to test for numbers 0-9 in the password.
russom-g Oct 20, 2026
db81678
Add test case for checking non-alphanumeric symbols in password.
russom-g Oct 20, 2026
0aede1c
Add more condition for checking non-alphanumeric symbols
russom-g Oct 20, 2026
9140665
Add test case for testing previous password is not reused.
russom-g Oct 20, 2026
b627dd7
Refactor code, update and fix bugs.
russom-g Oct 21, 2026
3df0769
Answer and explain
russom-g Oct 22, 2026
9a77853
Format code with prettier.
russom-g Oct 22, 2026
62a181f
Remove practice-tdd changes from this PR
russom-g Oct 22, 2026
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
4 changes: 4 additions & 0 deletions sprint-3-stretch-exercises/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ console.log(find("code your future", "z"));
// Pay particular attention to the following:

// a) How the index variable updates during the call to find
// - index starts at 0 and increase by 1 each time in the loop. When a character match is found the index return and the function stops.
// b) What is the if statement used to check
// - It checks whether the character at position index of str is exactly equal to char. If so it returns that position.
// c) Why is index++ being used?
// - index++ checks the next character of str. Without index would stay at 0 and the loop would never stop.
// d) What is the condition index < str.length used for?
// - To check the number of characters in str. Once index equals str.length and every characters is checked the loop stops
17 changes: 15 additions & 2 deletions sprint-3-stretch-exercises/password-validator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
export function isValidPassword(password) {
return password.length >= 5;
export function isValidPassword(password, previousPasswords = []) {
if (previousPasswords.includes(password)) {
return false;
}
if (password.length < 5) {
return false;
}

for (const char of password) {
if (!/[A-Z]/.test(password)) return false;
if (!/[a-z]/.test(password)) return false;
if (!/[0-9]/.test(password)) return false;
if (!/[!#$%.*&]/.test(password)) return false;
}
return true;
}
58 changes: 50 additions & 8 deletions sprint-3-stretch-exercises/password-validator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,53 @@ You must breakdown this problem in order to solve it. Find one test case first a
*/
import { isValidPassword } from "./password-validator.js";
test("password has at least 5 characters", () => {
// Arrange
const password = "12345";
// Act
const result = isValidPassword(password);
// Assert
expect(result).toEqual(true);
}
);
// Arrange
const password = "Az9!";
// Act
const result = isValidPassword(password);
// Assert
expect(result).toEqual(false);
});

// Have at least one English uppercase letter (A-Z)
test("password has at least uppercase letter", () => {
const password = "1az9!";
const result = isValidPassword(password);
expect(result).toEqual(false);
});

// Have at least one English lowercase letter (a-z)
test("password has at least lowercase letter", () => {
const password = "1AZ9!";
const result = isValidPassword(password);
expect(result).toEqual(false);
});

// Have at least one number (0-9)
test("password has at least one number (0-9)", () => {
const password = "Aazc!";
const result = isValidPassword(password);
expect(result).toEqual(false);
});

// Have at least one of the following non-alphanumeric symbols: ("!", "#", "$", "%", ".", "*", "&")
test("password has at least non-alphanumeric symbols", () => {
const password = "1Az99";
const result = isValidPassword(password);
expect(result).toEqual(false);
});

// Must not be any previous password in the passwords array.
test("password must not be any previous password in the passwords array", () => {
const password = "1Az9!";
const previousPassword = ["1Az9!", "1HBz2!"];
const result = isValidPassword(password, previousPassword);
expect(result).toEqual(false);
});

// Valid password returns true.
test("valid password returns true", () => {
const password = "1Az9!";
const result = isValidPassword(password);
expect(result).toEqual(true);
});
Loading