Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
c3cc796
refactor: update formatAs12HourClock function to improve time parsing…
moses77-boop Oct 3, 2026
b03e0fb
refactor: update test syntax to use arrow functions for consistency
moses77-boop Oct 3, 2026
05e8ef3
fix: ensure formatAs12HourClock function exports correctly
moses77-boop Oct 3, 2026
1544b38
test: add test case for converting midnight time
moses77-boop Oct 3, 2026
8230a0e
refactor: improve time conversion logic and enhance test cases for cl…
moses77-boop Oct 3, 2026
ead95df
fix: correct return statement in formatAs12HourClock function for acc…
moses77-boop Oct 3, 2026
19e10f5
test: add test case for converting the last minute before noon
moses77-boop Oct 3, 2026
15938a2
test: add test case for converting exact noon to pm
moses77-boop Oct 3, 2026
8acdeaa
test: add test case for converting time just after noon
moses77-boop Oct 3, 2026
a7d1115
fix: add missing newline at end of timeConverter.test.js
moses77-boop Oct 3, 2026
ee8f85b
fix: remove space before am/pm in time formatting and clean up test c…
moses77-boop Oct 3, 2026
f93cd35
fix: remove space before period in time formatting
moses77-boop Oct 3, 2026
59863c5
test: add test case for converting late evening hour
moses77-boop Oct 3, 2026
c6ed571
test: add test case for converting last minute of the day
moses77-boop Oct 3, 2026
ced1c53
fix: correct expected output for first afternoon hour test case
moses77-boop Oct 3, 2026
9f0876f
test: add test case for preserving minutes with leading zero
moses77-boop Oct 3, 2026
03c860b
test: update console log to test formatting for 8:00 AM
moses77-boop Oct 3, 2026
42d563c
test: add test case for preserving non-zero minutes
moses77-boop Oct 3, 2026
91ccb0c
test: update console log to test formatting for 8:40 AM
moses77-boop Oct 3, 2026
472364d
Remove commented-out code from time formatting function
moses77-boop Oct 4, 2026
5b48a96
Remove console log from time formatting function
moses77-boop Oct 4, 2026
8a74015
Add jsconfig.json for TypeScript configuration
moses77-boop Oct 4, 2026
27919c8
Format code and improve readability
moses77-boop Oct 4, 2026
fa688b1
Simplify period determination and improve formatting
moses77-boop Oct 5, 2026
5d58269
Refactor display hour calculation for 12-hour clock format
moses77-boop Oct 5, 2026
f9fac2a
Remove jsconfig.json and clean up package.json by deleting devDepende…
moses77-boop Oct 5, 2026
aba0771
Refactor folders to match main
moses77-boop Oct 5, 2026
dc99174
Add test case for classifying acute angles
moses77-boop Oct 8, 2026
ca9a48e
Add test case for classifying acute angles at 1 degree
moses77-boop Oct 8, 2026
e9127dd
Add test case for classifying acute angles at 89 degrees
moses77-boop Oct 8, 2026
965d13c
Implement angle classification function for acute and right angles
moses77-boop Oct 8, 2026
f95598e
Add test cases for classifying obtuse angles
moses77-boop Oct 8, 2026
727a787
add angle classification logic for obtuse angles
moses77-boop Oct 8, 2026
fc10ee8
Add test case for classifying straight angles
moses77-boop Oct 8, 2026
a54dbf3
add angle classification logic for straight angle
moses77-boop Oct 8, 2026
59841f3
Add test cases for classifying reflex angles
moses77-boop Oct 8, 2026
985fc65
add angle classification logic for reflex angle
moses77-boop Oct 8, 2026
e34c680
Add test cases for classifying invalid angles
moses77-boop Oct 8, 2026
d044803
Fix logic for invalid angle classification
moses77-boop Oct 8, 2026
dcbaa8a
Fix typo in angle classification for right angle
moses77-boop Oct 8, 2026
cafa444
Fix logic for reflex angle classification
moses77-boop Oct 8, 2026
c864dae
Implement isProperFraction function to evaluate proper fractions
moses77-boop Oct 8, 2026
25a95f7
Fix return values in isProperFraction function to boolean type and up…
moses77-boop Oct 8, 2026
a494567
Add test case for negative numerator in isProperFraction function
moses77-boop Oct 8, 2026
f9957fb
Add test case for negative denominator in isProperFraction function
moses77-boop Oct 8, 2026
8ad8453
Add test case for negative numerator and denominator in isProperFract…
moses77-boop Oct 8, 2026
5833229
Add test case for improper fractions in isProperFraction function
moses77-boop Oct 8, 2026
6735c73
Add test case for basic improper fraction in isProperFraction function
moses77-boop Oct 8, 2026
e2cac11
Add test case for equal numerator and denominator in isProperFraction…
moses77-boop Oct 8, 2026
ebfa5cc
Add test case for zero denominator in isProperFraction function
moses77-boop Oct 8, 2026
157c520
Add test case for negative numerator in isProperFraction function
moses77-boop Oct 8, 2026
68c5501
Add test case for negative denominator in isProperFraction function
moses77-boop Oct 8, 2026
7df31ab
Add test case for negative numerator and denominator in isProperFract…
moses77-boop Oct 8, 2026
39c47a2
Implement valid suits array in getCardValue function
moses77-boop Oct 8, 2026
ecd96e6
Fix syntax error in validSuits array in getCardValue function
moses77-boop Oct 8, 2026
7efe47c
Add numberRanks array to getCardValue function
moses77-boop Oct 8, 2026
f85638b
Add faceRanks array to getCardValue function
moses77-boop Oct 8, 2026
d37ed99
Add faceRanks array to getCardValue function
moses77-boop Oct 8, 2026
e1ddceb
Add error handling for invalid card format in getCardValue function
moses77-boop Oct 8, 2026
fcf852f
add initial validation for card input in getCardValue function
moses77-boop Oct 8, 2026
c1b599d
Add suit and rank extraction with validation in getCardValue function
moses77-boop Oct 8, 2026
7567f28
Implement handling for Ace rank in getCardValue function
moses77-boop Oct 8, 2026
93b333a
implement handling for faceRanks to return 10 for face cards
moses77-boop Oct 8, 2026
1348019
Refactor getCardValue function to ensure proper handling of number ra…
moses77-boop Oct 8, 2026
e7cfd7b
Fix suit representation in getCardValue function to use Unicode chara…
moses77-boop Oct 8, 2026
cd4dc16
Comment out console log statement for getCardValue function
moses77-boop Oct 8, 2026
d60f2bd
Add test case for Ace card value
moses77-boop Oct 8, 2026
f38db7f
Add test cases for face cards to ensure they return a value of 10
moses77-boop Oct 8, 2026
c25755d
Add test case for number cards 2 to 10 to verify correct value returns
moses77-boop Oct 8, 2026
f3c9bda
Fix formatting in number card test for consistency
moses77-boop Oct 8, 2026
84f32b8
Add test for valid double-digit '10' card to ensure correct value ret…
moses77-boop Oct 8, 2026
ea302ed
Add tests to ensure all four suits are accepted
moses77-boop Oct 8, 2026
78d0ff4
Add test for missing suit to validate error handling
moses77-boop Oct 8, 2026
6635d24
Add test for missing ranks to validate error handling
moses77-boop Oct 8, 2026
700c2b9
Fix tests for missing suit and ranks to ensure proper error handling
moses77-boop Oct 8, 2026
c06b701
Add test for empty strings to validate error handling
moses77-boop Oct 8, 2026
bc54e01
Add test for out-of-range number ranks to validate error handling
moses77-boop Oct 8, 2026
47797b5
Add test for unknown suit to validate error handling
moses77-boop Oct 8, 2026
a6231b0
Add test for lowercase ranks to validate error handling
moses77-boop Oct 8, 2026
20e286a
Add test for suit before rank to validate error handling
moses77-boop Oct 8, 2026
d91a6cb
Add tests for extra characters, spaces, and non-string inputs to vali…
moses77-boop Oct 8, 2026
2052992
Remove commented-out console log for getCardValue function
moses77-boop Oct 8, 2026
e021e17
Remove formatAs12HourClock function and its tests due to refactoring
moses77-boop Oct 8, 2026
5c7ee79
Add formatAs12HourClock function and corresponding tests for time con…
moses77-boop Oct 8, 2026
1c195d7
Remove formatAs12HourClock function and its tests due to refactoring
moses77-boop Oct 8, 2026
7a4a0c7
Implement formatAs12HourClock function with comprehensive tests for t…
moses77-boop Oct 8, 2026
e313bdc
Remove formatAs12HourClock function and its tests due to refactoring
moses77-boop Oct 8, 2026
c6ae2f7
Delete format-clock-edge-cases/timeConverter.js
moses77-boop Oct 8, 2026
32535c7
Add formatAs12HourClock function and comprehensive tests for edge cases
moses77-boop Oct 8, 2026
0ea7ccc
Merge branch 'coursework/sprint-3-implement-and-rewrite' of https://g…
moses77-boop Oct 8, 2026
46a0c2e
Complete Sprint 3 implement and rewrite exercises
moses77-boop Oct 8, 2026
c836b42
Merge remote-tracking branch 'origin/coursework/sprint-3-implement-an…
moses77-boop Oct 8, 2026
072555c
Delete format-clock-edge-cases/timeConverter.test.js
moses77-boop Oct 8, 2026
6bba53a
Exclude format-clock-edge-cases from PR
moses77-boop Oct 8, 2026
1b0e5bb
Merge remote-tracking branch 'origin/coursework/sprint-3-implement-an…
moses77-boop Oct 8, 2026
d11f634
Add unit tests for time conversion in timeConverter.js
moses77-boop Oct 9, 2026
9474239
Remove formatAs12HourClock function and associated tests
moses77-boop Oct 9, 2026
4a91c03
Remove formatAs12HourClock function and associated tests
moses77-boop Oct 9, 2026
cc3274e
Merge branch 'coursework/sprint-3-implement-and-rewrite' of https://g…
moses77-boop Oct 9, 2026
a8d45ee
Add unit tests for time conversion in timeConverter.js
moses77-boop Oct 9, 2026
6369da2
Merge remote-tracking branch 'origin/coursework/sprint-3-implement-an…
moses77-boop Oct 9, 2026
e817ed0
Implement formatAs12HourClock function and add comprehensive unit tests
moses77-boop Oct 9, 2026
d589535
Revert unrelated format-clock-edge-cases changes
moses77-boop Oct 9, 2026
1cb5d48
Fix countChar function to correctly count occurrences of a character …
moses77-boop Oct 9, 2026
a8ffa73
Add missing imports for test framework in count.test.js
moses77-boop Oct 9, 2026
26aa530
Replace expect with assert in countChar test for consistency
moses77-boop Oct 9, 2026
588a65f
Add test case to verify countChar returns 0 for non-existent character
moses77-boop Oct 9, 2026
09fa9f9
chore: add package.json for practice-tdd with Jest as dev dependency
moses77-boop Oct 9, 2026
0953a6f
Fix getOrdinalNumber function to return correct ordinal suffix and up…
moses77-boop Oct 9, 2026
21d3205
Fix getOrdinalNumber function to handle special case for 11th correctly
moses77-boop Oct 9, 2026
1766da8
Refactor getOrdinalNumber function to check for 11th and improve read…
moses77-boop Oct 9, 2026
39419df
Add @types/jest as a dev dependency and update compiler options
moses77-boop Oct 9, 2026
6182d67
Update test script in package.json to use experimental VM modules for…
moses77-boop Oct 9, 2026
281f041
Add test cases for numbers ending with 2 in getOrdinalNumber function
moses77-boop Oct 9, 2026
e6d3f80
Fix getOrdinalNumber function to correctly handle numbers ending with 2
moses77-boop Oct 9, 2026
ca98356
Add test cases for numbers ending with 3 in getOrdinalNumber function
moses77-boop Oct 9, 2026
e430ece
Fix getOrdinalNumber function to correctly handle numbers ending with 3
moses77-boop Oct 9, 2026
4abd0e7
Add test cases for numbers ending with 11, 12, and 13 in getOrdinalNu…
moses77-boop Oct 9, 2026
5f7b139
Fix getOrdinalNumber function to correctly handle numbers ending with…
moses77-boop Oct 9, 2026
75a8087
Add test cases for numbers ending with 4, 10, 20, and 100 in getOrdin…
moses77-boop Oct 9, 2026
9717056
Refactor repeatStr function to accept parameters for string and count
moses77-boop Oct 9, 2026
677819c
Refactor repeatStr function to correctly handle count parameter and p…
moses77-boop Oct 9, 2026
d5bb21a
Add test case for repeating string 1 time
moses77-boop Oct 9, 2026
99c6335
Refactor repeatStr function to remove redundant string concatenation …
moses77-boop Oct 9, 2026
b780757
Fix test case for repeating string 1 time and ensure correct handling…
moses77-boop Oct 9, 2026
64be7a7
Add test case to ensure error is thrown for negative count in repeatS…
moses77-boop Oct 9, 2026
41a3faa
Fix syntax error in test cases by adding missing closing braces
moses77-boop Oct 9, 2026
56fa378
Revert unrelated implement-and-rewrite-tests changes
moses77-boop Oct 9, 2026
9370f27
Fix variable naming for clarity in getOrdinalNumber function
moses77-boop Oct 9, 2026
389c799
Add test case for handling empty string in repeatStr function
moses77-boop Oct 9, 2026
639dda6
Add test case to ensure error is thrown for negative count with empty…
moses77-boop Oct 9, 2026
4a915c3
Add test case for repeating a string of symbols in repeatStr function
moses77-boop Oct 9, 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
9 changes: 8 additions & 1 deletion practice-tdd/count.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
export function countChar(stringOfCharacters, findCharacter) {
return 5
let count = 0;

for (let i = 0; i < stringOfCharacters.length; i++){
if(stringOfCharacters[1] === findCharacter){
count++
}
}
return count;
}
11 changes: 10 additions & 1 deletion practice-tdd/count.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// implement a function countChar that counts the number of times a character occurs in a string
import { countChar } from "./count.js";
import { test } from "node:test";
import assert from "node:assert/strict";
// Given a string `str` and a single character `char` to search for,
// When the countChar function is called with these inputs,
// Then it should:
Expand All @@ -14,11 +16,18 @@ test("should count multiple occurrences of a character", () => {
const str = "aaaaa";
const char = "a";
const count = countChar(str, char);
expect(count).toEqual(5);
assert.equal(count, 5);
});

// Scenario: No Occurrences
// Given the input string `str`,
// And a character `char` that does not exist within `str`.
// When the function is called with these inputs,
// Then it should return 0, indicating that no occurrences of `char` were found.

test("should return 0 when the character does not occur", () => {
const str = "moses";
const char = "z";
const count = countChar(str, char);
assert.equal(count, 0);
})
18 changes: 17 additions & 1 deletion practice-tdd/get-ordinal-number.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
export function getOrdinalNumber(num) {
return "1st";
const lastDigit = num % 10;
const lastTwoDigit = num % 100;

if (lastTwoDigit === 11 || lastTwoDigit === 12 || lastTwoDigit === 13) {
return `${num}th`;
}
if (lastDigit === 1) {
return `${num}st`;
}
if (lastDigit === 2) {
return `${num}nd`;
}
if (lastDigit === 3) {
return `${num}rd`;
}
return `${num}th`;

}
28 changes: 28 additions & 0 deletions practice-tdd/get-ordinal-number.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,31 @@ test("should append 'st' for numbers ending with 1, except those ending with 11"
expect(getOrdinalNumber(21)).toEqual("21st");
expect(getOrdinalNumber(131)).toEqual("131st");
});

test("should append 'nd' for numbers ending with 2, except those ending with 12", () => {
expect(getOrdinalNumber(2)).toEqual("2nd");
expect(getOrdinalNumber(22)).toEqual("22nd");
expect(getOrdinalNumber(122)).toEqual("122nd");
});

test("should append 'rd' for numbers ending with 3, except those ending with 13", () => {
expect(getOrdinalNumber(3)).toEqual("3rd");
expect(getOrdinalNumber(23)).toEqual("23rd");
expect(getOrdinalNumber(133)).toEqual("133rd");
});

test("should append 'th' for numbers ending with 11,12 or 13", () => {
expect(getOrdinalNumber(11)).toEqual("11th");
expect(getOrdinalNumber(12)).toEqual("12th");
expect(getOrdinalNumber(13)).toEqual("13th");
expect(getOrdinalNumber(111)).toEqual("111th");
expect(getOrdinalNumber(112)).toEqual("112th");
expect(getOrdinalNumber(113)).toEqual("113th");
});

test("should append 'th' for all other nnumbers", () => {
expect(getOrdinalNumber(4)).toEqual("4th");
expect(getOrdinalNumber(10)).toEqual("10th");
expect(getOrdinalNumber(20)).toEqual("20th");
expect(getOrdinalNumber(100)).toEqual("100th");
});
Loading
Loading