Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion e2e/api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ test("[API E2E] /api/auth/session returns a JSON object", async ({
}) => {
const res = await request.get("/api/auth/session");
expect(res.status()).toBe(200);
const body = await res.json();
if (!res.ok) throw new Error("Request failed");
const body = await res.json();
// An unauthenticated session is an empty object {}, never null/undefined.
expect(typeof body).toBe("object");
});
Expand Down
2 changes: 1 addition & 1 deletion src/lib/consistency-score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
activeDates: Set<string>,
timeZone = "UTC",
): ConsistencyScoreResult {
const sortedDates = Array.from(activeDates).sort();
const sortedDates = Array.from(activeDates).sort((a, b) => a - b);

Check failure on line 136 in src/lib/consistency-score.ts

View workflow job for this annotation

GitHub Actions / Type check

The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 136 in src/lib/consistency-score.ts

View workflow job for this annotation

GitHub Actions / Type check

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
const today = todayInTimezone(timeZone);

const weeklyConsistency = computeWeeklyConsistency(activeDates);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/date-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
return `${yyyy}-${mm}-${dd}`;
})();

const uniqueDates = [...new Set(dates)].sort().reverse();
const uniqueDates = [...new Set(dates)].sort((a, b) => a - b).reverse();

Check failure on line 252 in src/lib/date-utils.ts

View workflow job for this annotation

GitHub Actions / Type check

The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 252 in src/lib/date-utils.ts

View workflow job for this annotation

GitHub Actions / Type check

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

if (uniqueDates[0] !== today && uniqueDates[0] !== yesterday) {
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/streak-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
if (key) dayKeys.add(key);
}

return Array.from(dayKeys).sort();
return Array.from(dayKeys).sort((a, b) => a - b);

Check failure on line 23 in src/lib/streak-utils.ts

View workflow job for this annotation

GitHub Actions / Type check

The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 23 in src/lib/streak-utils.ts

View workflow job for this annotation

GitHub Actions / Type check

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
}

function getRuns(dates: StreakDate[]): { end: string; length: number }[] {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/streak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
...Array.from(activeDates),
...Array.from(freezeDates),
]);
const commitDays = Array.from(combinedDates).sort();
const commitDays = Array.from(combinedDates).sort((a, b) => a - b);

Check failure on line 65 in src/lib/streak.ts

View workflow job for this annotation

GitHub Actions / Type check

The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

Check failure on line 65 in src/lib/streak.ts

View workflow job for this annotation

GitHub Actions / Type check

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

if (commitDays.length === 0) {
return {
Expand Down
Loading