MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / assertNextTimeInfo

Function assertNextTimeInfo

src/pkg/utils/utils.test.ts:40–64  ·  view source on GitHub ↗
(expr: string, date: Date, expected: any)

Source from the content-addressed store, hash-verified

38});
39
40const assertNextTimeInfo = (expr: string, date: Date, expected: any) => {
41 const actual = nextTimeInfo(expr, date);
42 const result = {
43 next: actual.next.toFormat(actual.format),
44 once: actual.once,
45 };
46
47 // 1) 失败时讯息包含 expr / expected / actual
48 // 2) 用 soft,方便一次看到多笔失败(可选)
49 expect
50 .soft(
51 result,
52 [
53 "",
54 "",
55 `expr: ${expr}`,
56 `date: ${date.toISOString()}`,
57 `expected: ${JSON.stringify(expected)}`,
58 `actual: ${JSON.stringify(result)}`,
59 "",
60 "",
61 ].join("\n")
62 )
63 .toEqual(expected);
64};
65
66describe.concurrent("nextTimeDisplay ERROR SAFE", () => {
67 it.concurrent.each([

Callers 1

utils.test.tsFile · 0.85

Calls 1

nextTimeInfoFunction · 0.90

Tested by

no test coverage detected