Datasets:
Download code/evaluation-code/v0.2-0c2690ae/apps/console/web/tests/run-summary.test.ts from VEHwang/cocogni4d: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/apps/console/web/tests/run-summary.test.ts
- Command line
-
hf download hf://datasets/VEHwang/cocogni4d/code/evaluation-code/v0.2-0c2690ae/apps/console/web/tests/run-summary.test.ts
-
curl -L -o run-summary.test.ts https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/apps/console/web/tests/run-summary.test.ts
1.34 kB
| import assert from 'node:assert/strict'; | |
| import test from 'node:test'; | |
| import {lengthLabel, localTime, runSummary} from '../src/generation-logic.ts'; | |
| const stages = [{seconds: 10.4}, {seconds: 5.2}] as Parameters<typeof runSummary>[0]['stages']; | |
| test('结果屏顶部写出完成与否、开始时间和用时、和哪一批比(设计 R-1)', () => { | |
| const done = runSummary({status: 'completed', created_at: '2026-10-23T11:25:31+08:00', stages}, {label: '上次', created_at: '2026-10-23T10:00:00+08:00'}); | |
| assert.equal(done.state, '完成'); assert.ok(done.ok); | |
| assert.match(done.time, /开始 · 用时 16 s$/); | |
| assert.match(done.compare, /^和上一批比:上次(/); | |
| const partial = runSummary({status: 'completed_with_failures', created_at: '2026-10-23T11:25:31+08:00', stages}); | |
| assert.equal(partial.state, '完成(有失败段)'); assert.ok(!partial.ok); | |
| assert.equal(partial.compare, '没有更早的批次,不比'); | |
| }); | |
| test('时刻用中文格式、不随浏览器语言;段长档位写中文', () => { | |
| assert.match(localTime('2026-10-23T12:46:01+08:00'), /^2026\/10\/23 \d{2}:46:01$/); | |
| assert.doesNotMatch(localTime('2026-10-23T12:46:01+08:00'), /AM|PM/); | |
| assert.equal(lengthLabel('short'), '短段'); assert.equal(lengthLabel('long'), '长段'); assert.equal(lengthLabel('x'), 'x'); | |
| }); | |