Skip to content

Commit 0add16d

Browse files
Copilotnitrocode
andauthored
fix: address code review — reduce E2E timeout, remove error filter, fix parse fn
Agent-Logs-Url: https://github.com/nitrocode/token-deathclock/sessions/e7e66a7b-8a0e-44c0-91ca-473ea4a3dcd3 Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
1 parent 477d69f commit 0add16d

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

‎chart-date-adapter.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
if (value === null || value === undefined || value === '') return null;
4646
if (value instanceof Date) return isNaN(value.getTime()) ? null : value.getTime();
4747
if (typeof value === 'number') return value;
48-
var d = new Date(value);
49-
return isNaN(d.getTime()) ? null : d.getTime();
48+
var ms = new Date(value).getTime();
49+
return isNaN(ms) ? null : ms;
5050
},
5151

5252
// Format a Unix timestamp (ms) using a simple format string.

‎script.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,9 @@
397397
${state !== 'dead' ? 'tabindex="0" role="button"' : 'aria-disabled="true"'}>${content}</div>`;
398398
}
399399

400-
// Maximum days to render in life-blocks view.
400+
// Maximum days to render in life-blocks view (~10 years).
401401
// Beyond this, a summary block is shown to avoid creating millions of DOM elements.
402-
const MAX_LB_DAYS = 3650; // 10 years
402+
const MAX_LB_DAYS = 3650;
403403

404404
// ---- View renderers ----
405405

‎tests/e2e/death-clock.spec.js‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const { test, expect } = require('@playwright/test');
1616
/**
1717
* Wait until an element's textContent is non-empty and not "Loading…".
1818
*/
19-
async function waitForCounter(page, selector, timeout = 8000) {
19+
async function waitForCounter(page, selector, timeout = 3000) {
2020
await expect(async () => {
2121
const text = await page.locator(selector).textContent();
2222
expect(text).toBeTruthy();
@@ -196,9 +196,7 @@ test.describe('AI Death Clock — end-to-end', () => {
196196
page.on('pageerror', (err) => errors.push(err.message));
197197
await page.reload();
198198
await page.waitForLoadState('networkidle');
199-
// Filter out expected/benign Chart errors if adapter is missing in test env
200-
const fatal = errors.filter((e) => !e.includes('date adapter'));
201-
expect(fatal).toHaveLength(0);
199+
expect(errors).toHaveLength(0);
202200
});
203201

204202
// ── Security: no XSS via milestone content ────────────────────────────────

0 commit comments

Comments
 (0)