Skip to content

Commit c41cb68

Browse files
committed
edited notes: better names in tests
1 parent 11ae23d commit c41cb68

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

apps/server/src/routes/api/edited-notes.spec.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ const expectedMonthMinus2 = "2024-11";
1717
const expectedYear = "2025";
1818
const expectedYearMinus1 = "2024";
1919

20-
function runTest(dateStrToResolve: string, expectedDate: string) {
20+
function keywordResolvesToDate(dateStrOrKeyword: string, expectedDate: string) {
2121
cls.init(() => {
2222
cls.set("localNowDateTime", clientDate);
23-
const dateFilter = dateNoteLabelKeywordToDateFilter(dateStrToResolve);
23+
const dateFilter = dateNoteLabelKeywordToDateFilter(dateStrOrKeyword);
2424
expect(dateFilter.date).toBe(expectedDate);
2525
});
2626
}
@@ -39,51 +39,51 @@ describe("edited-notes::dateNoteLabelKeywordToDateFilter", () => {
3939
});
4040

4141
it("resolves 'TODAY' to today's date", () => {
42-
runTest("TODAY", expectedToday);
42+
keywordResolvesToDate("TODAY", expectedToday);
4343
});
4444

4545
it("resolves 'MONTH' to current month", () => {
46-
runTest("MONTH", expectedMonth);
46+
keywordResolvesToDate("MONTH", expectedMonth);
4747
});
4848

4949
it("resolves 'YEAR' to current year", () => {
50-
runTest("YEAR", expectedYear);
50+
keywordResolvesToDate("YEAR", expectedYear);
5151
});
5252

5353
it("resolves 'TODAY-1' to yesterday's date", () => {
54-
runTest("TODAY-1", expectedTodayMinus1);
54+
keywordResolvesToDate("TODAY-1", expectedTodayMinus1);
5555
});
5656

5757
it("resolves 'MONTH-2' to 2 months ago", () => {
58-
runTest("MONTH-2", expectedMonthMinus2);
58+
keywordResolvesToDate("MONTH-2", expectedMonthMinus2);
5959
});
6060

6161
it("resolves 'YEAR-1' to last year", () => {
62-
runTest("YEAR-1", expectedYearMinus1);
62+
keywordResolvesToDate("YEAR-1", expectedYearMinus1);
6363
});
6464

6565
it("returns original string for day", () => {
66-
runTest("2020-12-31", "2020-12-31");
66+
keywordResolvesToDate("2020-12-31", "2020-12-31");
6767
});
6868

6969
it("returns original string for month", () => {
70-
runTest("2020-12", "2020-12");
70+
keywordResolvesToDate("2020-12", "2020-12");
7171
});
7272

7373
it("returns original string for year", () => {
74-
runTest("2020", "2020");
74+
keywordResolvesToDate("2020", "2020");
7575
});
7676

7777
it("returns original string for unrecognized keyword", () => {
78-
runTest("FOO", "FOO");
78+
keywordResolvesToDate("FOO", "FOO");
7979
});
8080

8181
it("returns original string for partially recognized keyword", () => {
82-
runTest("TODAY-", "TODAY-");
82+
keywordResolvesToDate("TODAY-", "TODAY-");
8383
});
8484

8585
it("resolves 'today' (lowercase) to today's date", () => {
86-
runTest("today", expectedToday);
86+
keywordResolvesToDate("today", expectedToday);
8787
});
8888

8989
});

0 commit comments

Comments
 (0)