@niwa-labs/timer 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +2 -2
- package/package.json +35 -4
- package/src/cockpit/index.tsx +182 -0
- package/src/index.ts +970 -0
- package/src/records.ts +149 -0
- package/test/clock.test.ts +178 -0
- package/test/declarations.test.ts +66 -0
- package/test/firing-writes.test.ts +60 -0
- package/test/fixtures/failing-writes.ts +31 -0
- package/test/fixtures/missed-dues-host.ts +73 -0
- package/test/missed-dues.test.ts +127 -0
- package/test/schedule-state.test.ts +115 -0
- package/test/sleep-writes.test.ts +147 -0
- package/test/timer-list.test.ts +114 -0
- package/test/timer-sleep.test.ts +359 -0
- package/test/trigger.test.ts +57 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// What the scheduler remembers: the schedule a due belongs to, timers named like the properties
|
|
2
|
+
// of an object, and the ids of the firings read from the journal once.
|
|
3
|
+
|
|
4
|
+
import { expect, test } from "bun:test";
|
|
5
|
+
|
|
6
|
+
import { actionName } from "@niwa-labs/core";
|
|
7
|
+
import type { StoredRecord } from "@niwa-labs/core";
|
|
8
|
+
import type { Plugin, PluginApi } from "@niwa-labs/plugin";
|
|
9
|
+
import { createNiwa, eventually, tempHome, testClock } from "@niwa-labs/testing";
|
|
10
|
+
|
|
11
|
+
import { timers } from "../src/index.ts";
|
|
12
|
+
import type { TimerEntity } from "../src/index.ts";
|
|
13
|
+
|
|
14
|
+
type Host = ReturnType<typeof createNiwa>;
|
|
15
|
+
|
|
16
|
+
const START = 1_700_000_000_000;
|
|
17
|
+
const LIST = actionName("timer.list");
|
|
18
|
+
|
|
19
|
+
const ofType = (records: readonly StoredRecord[], type: string): StoredRecord[] => records.filter((row) => row.type === type);
|
|
20
|
+
const listed = async (niwa: Host): Promise<TimerEntity[]> => ((await niwa.call(LIST, {})) as { timers: TimerEntity[] }).timers;
|
|
21
|
+
|
|
22
|
+
test("a timer declared again under its id with another schedule starts from the new one", async () => {
|
|
23
|
+
const home = await tempHome();
|
|
24
|
+
try {
|
|
25
|
+
// The old one fired and is done; the new one is later, and it is not mistaken for done.
|
|
26
|
+
const first = createNiwa({ home: home.path, clock: testClock(START) });
|
|
27
|
+
first.use(timers([{ id: "job", at: START + 1000 }]));
|
|
28
|
+
await first.serve();
|
|
29
|
+
await (first as Host).close();
|
|
30
|
+
|
|
31
|
+
const second = createNiwa({ home: home.path, clock: testClock(START + 5000) });
|
|
32
|
+
second.use(timers([{ id: "job", at: START + 9000 }]));
|
|
33
|
+
await second.serve();
|
|
34
|
+
expect((await listed(second))[0]).toMatchObject({ nextDue: START + 9000 });
|
|
35
|
+
await second.close();
|
|
36
|
+
|
|
37
|
+
// The old date is still ahead and the new one is sooner: the new one is what fires.
|
|
38
|
+
const third = createNiwa({ home: home.path, clock: testClock(START + 6000) });
|
|
39
|
+
third.use(timers([{ id: "job", at: START + 7000 }]));
|
|
40
|
+
await third.serve();
|
|
41
|
+
expect((await listed(third))[0]).toMatchObject({ nextDue: START + 7000 });
|
|
42
|
+
await third.close();
|
|
43
|
+
} finally {
|
|
44
|
+
await home.cleanup();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("a timer named like a property of every object is scheduled, fires and is remembered", async () => {
|
|
49
|
+
const home = await tempHome();
|
|
50
|
+
try {
|
|
51
|
+
const names = ["constructor", "__proto__", "toString", "hasOwnProperty"];
|
|
52
|
+
const defs = names.map((id) => ({ id, every: 1000 }));
|
|
53
|
+
const first = createNiwa({ home: home.path, clock: testClock(START) });
|
|
54
|
+
first.use(timers(defs));
|
|
55
|
+
await first.serve();
|
|
56
|
+
expect((await listed(first)).map((one) => one.name).sort()).toEqual([...names].sort());
|
|
57
|
+
await first.close();
|
|
58
|
+
|
|
59
|
+
const clock = testClock(START + 1500);
|
|
60
|
+
const second = createNiwa({ home: home.path, clock });
|
|
61
|
+
second.use(timers(defs));
|
|
62
|
+
await second.serve();
|
|
63
|
+
await eventually(
|
|
64
|
+
async () => new Set(ofType(await second.records.read(), "timer.fired").map((row) => (row.data as { timer: string }).timer)).size === names.length,
|
|
65
|
+
10_000,
|
|
66
|
+
"not every timer fired",
|
|
67
|
+
);
|
|
68
|
+
// What was remembered is read back: the due is the one the firing left.
|
|
69
|
+
for (const one of await listed(second)) expect(one.nextDue).toBeGreaterThan(START + 1500);
|
|
70
|
+
await second.close();
|
|
71
|
+
} finally {
|
|
72
|
+
await home.cleanup();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("the ids of the firings are read from the journal once, not again for each firing", async () => {
|
|
77
|
+
const home = await tempHome();
|
|
78
|
+
const clock = testClock(START);
|
|
79
|
+
const niwa = createNiwa({ home: home.path, clock });
|
|
80
|
+
let read = 0;
|
|
81
|
+
const counting = (inner: Plugin): Plugin => ({
|
|
82
|
+
...inner,
|
|
83
|
+
setup(api: PluginApi) {
|
|
84
|
+
inner.setup({
|
|
85
|
+
...api,
|
|
86
|
+
journal: () => {
|
|
87
|
+
const journal = api.journal?.();
|
|
88
|
+
if (journal === undefined) return undefined;
|
|
89
|
+
return new Proxy(journal, {
|
|
90
|
+
get: (target, name) => {
|
|
91
|
+
if (name !== "since") return Reflect.get(target, name) as unknown;
|
|
92
|
+
return (...args: Parameters<typeof target.since>) => {
|
|
93
|
+
const rows = target.since(...args);
|
|
94
|
+
if (args[1]?.includes("timer.fired") === true) read += rows.length;
|
|
95
|
+
return rows;
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
try {
|
|
104
|
+
niwa.use(counting(timers([{ id: "tick", every: 10 }])));
|
|
105
|
+
await niwa.serve();
|
|
106
|
+
for (let step = 0; step < 40; step += 1) await clock.advance(10);
|
|
107
|
+
const fired = ofType(await niwa.records.read(), "timer.fired").length;
|
|
108
|
+
expect(fired).toBeGreaterThanOrEqual(40);
|
|
109
|
+
// One read of each firing for the ids, with some for the list: not a pass over the history for every firing.
|
|
110
|
+
expect(read).toBeLessThan(fired * 4);
|
|
111
|
+
} finally {
|
|
112
|
+
await niwa.close();
|
|
113
|
+
await home.cleanup();
|
|
114
|
+
}
|
|
115
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// A sleep is over when its wake is written, and a stored request that cannot be a sleep does not
|
|
2
|
+
// stop the others: a wake that failed is tried again, a place is slept at once, and a key that is
|
|
3
|
+
// empty or has whitespace is refused.
|
|
4
|
+
|
|
5
|
+
import { expect, test } from "bun:test";
|
|
6
|
+
|
|
7
|
+
import { actionName, record } from "@niwa-labs/core";
|
|
8
|
+
import type { StoredRecord } from "@niwa-labs/core";
|
|
9
|
+
import { plugin } from "@niwa-labs/plugin";
|
|
10
|
+
import { createNiwa, eventually, tempHome, testClock } from "@niwa-labs/testing";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
|
|
13
|
+
import { sleep, timers } from "../src/index.ts";
|
|
14
|
+
import type { TimerEntity } from "../src/index.ts";
|
|
15
|
+
import { failing } from "./fixtures/failing-writes.ts";
|
|
16
|
+
|
|
17
|
+
type Host = ReturnType<typeof createNiwa>;
|
|
18
|
+
|
|
19
|
+
const START = 1_700_000_000_000;
|
|
20
|
+
const LIST = actionName("timer.list");
|
|
21
|
+
|
|
22
|
+
const ofType = (records: readonly StoredRecord[], type: string): StoredRecord[] => records.filter((row) => row.type === type);
|
|
23
|
+
const listed = async (niwa: Host): Promise<TimerEntity[]> => ((await niwa.call(LIST, {})) as { timers: TimerEntity[] }).timers;
|
|
24
|
+
|
|
25
|
+
const Start = record("test.schedule.start", z.object({}));
|
|
26
|
+
const Woke = record("test.schedule.woke", z.object({ note: z.string() }));
|
|
27
|
+
|
|
28
|
+
test("a wake that could not be written is tried again, and the handler wakes", async () => {
|
|
29
|
+
const home = await tempHome();
|
|
30
|
+
const clock = testClock(START);
|
|
31
|
+
const niwa = createNiwa({ home: home.path, clock });
|
|
32
|
+
const failures = { "timer.slept": 1 };
|
|
33
|
+
try {
|
|
34
|
+
niwa.use(failing(timers([]), failures));
|
|
35
|
+
niwa.use(
|
|
36
|
+
plugin("sleeper", (api) => {
|
|
37
|
+
api.declare(Start, Woke);
|
|
38
|
+
api.on(Start, async (_data, step) => {
|
|
39
|
+
await sleep(step, 200);
|
|
40
|
+
await step.emit(Woke, { note: "woke" });
|
|
41
|
+
});
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
await niwa.serve();
|
|
45
|
+
await niwa.emit(Start, {});
|
|
46
|
+
await eventually(async () => ofType(await niwa.records.read(), "timer.sleep.requested").length === 1, 10_000, "no request");
|
|
47
|
+
await clock.advance(200);
|
|
48
|
+
expect(failures["timer.slept"]).toBe(0);
|
|
49
|
+
expect(ofType(await niwa.records.read(), "timer.slept")).toHaveLength(0);
|
|
50
|
+
await clock.advance(1000);
|
|
51
|
+
await eventually(async () => ofType(await niwa.records.read(), Woke.name).length === 1, 10_000, "the handler stayed asleep");
|
|
52
|
+
expect(ofType(await niwa.records.read(), "timer.slept")).toHaveLength(1);
|
|
53
|
+
} finally {
|
|
54
|
+
await niwa.close();
|
|
55
|
+
await home.cleanup();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test("a second sleep at a key the invocation slept at is refused instead of waiting for ever", async () => {
|
|
60
|
+
const home = await tempHome();
|
|
61
|
+
const clock = testClock(START);
|
|
62
|
+
const niwa = createNiwa({ home: home.path, clock });
|
|
63
|
+
try {
|
|
64
|
+
niwa.use(timers([]));
|
|
65
|
+
niwa.use(
|
|
66
|
+
plugin("sleeper", (api) => {
|
|
67
|
+
api.declare(Start, Woke);
|
|
68
|
+
api.on(Start, async (_data, step) => {
|
|
69
|
+
await sleep(step, 100, "place");
|
|
70
|
+
let note = "second sleep allowed";
|
|
71
|
+
try {
|
|
72
|
+
await sleep(step, 100, "place");
|
|
73
|
+
} catch (error) {
|
|
74
|
+
note = error instanceof Error ? error.message : String(error);
|
|
75
|
+
}
|
|
76
|
+
await step.emit(Woke, { note });
|
|
77
|
+
});
|
|
78
|
+
}),
|
|
79
|
+
);
|
|
80
|
+
await niwa.serve();
|
|
81
|
+
await niwa.emit(Start, {});
|
|
82
|
+
await eventually(async () => ofType(await niwa.records.read(), "timer.sleep.requested").length === 1, 10_000, "no request");
|
|
83
|
+
await clock.advance(100);
|
|
84
|
+
await eventually(async () => ofType(await niwa.records.read(), Woke.name).length === 1, 10_000, "the handler did not go on");
|
|
85
|
+
const [woke] = ofType(await niwa.records.read(), Woke.name);
|
|
86
|
+
expect((woke?.data as { note: string }).note).toContain("slept at already");
|
|
87
|
+
} finally {
|
|
88
|
+
await niwa.close();
|
|
89
|
+
await home.cleanup();
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("a sleep request with an empty key or a key with whitespace is refused", async () => {
|
|
94
|
+
const home = await tempHome();
|
|
95
|
+
const niwa = createNiwa({ home: home.path, clock: testClock(START) });
|
|
96
|
+
try {
|
|
97
|
+
niwa.use(timers([]));
|
|
98
|
+
await niwa.serve();
|
|
99
|
+
const request = actionName("timer.sleep.request");
|
|
100
|
+
await expect(niwa.call(request, { at: START, key: "" })).rejects.toThrow();
|
|
101
|
+
await expect(niwa.call(request, { at: START, key: "two words" })).rejects.toThrow();
|
|
102
|
+
expect(ofType(await niwa.records.read(), "timer.sleep.requested")).toHaveLength(0);
|
|
103
|
+
} finally {
|
|
104
|
+
await niwa.close();
|
|
105
|
+
await home.cleanup();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
/** The sleep request as an older writer could have left it: the key is any string. */
|
|
110
|
+
const LooseRequest = record("timer.sleep.requested", z.object({ at: z.number(), key: z.string() }));
|
|
111
|
+
|
|
112
|
+
test("a stored sleep request with a bad key is skipped, and the timers and the other sleeps go on", async () => {
|
|
113
|
+
const home = await tempHome();
|
|
114
|
+
try {
|
|
115
|
+
const first = createNiwa({ home: home.path, clock: testClock(START) });
|
|
116
|
+
first.use(
|
|
117
|
+
plugin("loose", (api) => {
|
|
118
|
+
api.declare(LooseRequest);
|
|
119
|
+
api.service((ctx) => {
|
|
120
|
+
void (async () => {
|
|
121
|
+
await ctx.emit(LooseRequest, { at: START, key: "" });
|
|
122
|
+
await ctx.emit(LooseRequest, { at: START, key: "two words" });
|
|
123
|
+
await ctx.emit(LooseRequest, { at: START, key: "good-key" });
|
|
124
|
+
})();
|
|
125
|
+
return () => undefined;
|
|
126
|
+
});
|
|
127
|
+
}),
|
|
128
|
+
);
|
|
129
|
+
await first.serve();
|
|
130
|
+
await eventually(async () => ofType(await first.records.read(), "timer.sleep.requested").length === 3, 10_000, "the requests were not written");
|
|
131
|
+
await first.close();
|
|
132
|
+
|
|
133
|
+
const clock = testClock(START + 10);
|
|
134
|
+
const second = createNiwa({ home: home.path, clock });
|
|
135
|
+
second.use(timers([{ id: "after", every: 1000 }]));
|
|
136
|
+
await second.serve();
|
|
137
|
+
await eventually(async () => ofType(await second.records.read(), "timer.slept").length === 1, 10_000, "the good sleep was not woken");
|
|
138
|
+
expect((ofType(await second.records.read(), "timer.slept")[0]?.data as { key: string }).key).toBe("good-key");
|
|
139
|
+
// The list reads the same journal and shows the timers.
|
|
140
|
+
expect((await listed(second)).map((one) => one.name)).toEqual(["after"]);
|
|
141
|
+
await clock.advance(1000);
|
|
142
|
+
await eventually(async () => ofType(await second.records.read(), "timer.fired").length >= 1, 10_000, "the timer did not fire");
|
|
143
|
+
await second.close();
|
|
144
|
+
} finally {
|
|
145
|
+
await home.cleanup();
|
|
146
|
+
}
|
|
147
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// The ids of a firing and the structured view of the timers: `timer.list` and `timer.get`.
|
|
2
|
+
//
|
|
3
|
+
// A firing is an id of the common format (`fire-<hash>`), the hash of the timer and the due, so a
|
|
4
|
+
// firing written twice is one record. The timers are shown as data: name, description, schedule,
|
|
5
|
+
// next due and the id of the last firing.
|
|
6
|
+
|
|
7
|
+
import { expect, test } from "bun:test";
|
|
8
|
+
|
|
9
|
+
import { IdIndex, actionName, issueId, recordId, seq, timestamp } from "@niwa-labs/core";
|
|
10
|
+
import type { IssuedId } from "@niwa-labs/core";
|
|
11
|
+
import { createNiwa, tempHome, testClock } from "@niwa-labs/testing";
|
|
12
|
+
|
|
13
|
+
import { firingId, timer, timerId, timers } from "../src/index.ts";
|
|
14
|
+
import type { TimerEntity } from "../src/index.ts";
|
|
15
|
+
|
|
16
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
17
|
+
|
|
18
|
+
const LIST = actionName("timer.list");
|
|
19
|
+
const GET = actionName("timer.get");
|
|
20
|
+
|
|
21
|
+
/** What a firing of `name` due at `due` is born from. */
|
|
22
|
+
const seedOf = (name: string, due: number) => recordId(`timer:${name}:${due}`);
|
|
23
|
+
|
|
24
|
+
test("a firing has the common id, the hash of its timer and its due, and timer.list and timer.get show the timer as data", async () => {
|
|
25
|
+
const home = await tempHome();
|
|
26
|
+
const start = new Date(2024, 0, 1, 0, 0, 0, 0).getTime();
|
|
27
|
+
const clock = testClock(start);
|
|
28
|
+
const niwa = createNiwa({ home: home.path, clock });
|
|
29
|
+
try {
|
|
30
|
+
niwa.use(
|
|
31
|
+
timers([
|
|
32
|
+
timer.daily("03:17", { id: "morning", description: "the morning round" }),
|
|
33
|
+
timer.every(10 * DAY_MS),
|
|
34
|
+
{ id: "once-later", at: start + 100 * DAY_MS, missed: "skip" },
|
|
35
|
+
]),
|
|
36
|
+
);
|
|
37
|
+
await niwa.serve();
|
|
38
|
+
await clock.advance(3 * DAY_MS);
|
|
39
|
+
|
|
40
|
+
const firings = (await niwa.records.read()).filter((row) => row.type === "timer.fired");
|
|
41
|
+
expect(firings).toHaveLength(3);
|
|
42
|
+
for (const row of firings) {
|
|
43
|
+
const data = row.data as { timer: string; due: number };
|
|
44
|
+
expect(String(row.id)).toMatch(/^fire-[0-9a-f]{6,8}$/);
|
|
45
|
+
expect(String(row.id)).toBe(issueId("firing", seedOf(data.timer, data.due), []));
|
|
46
|
+
}
|
|
47
|
+
expect(new Set(firings.map((row) => row.id)).size).toBe(3);
|
|
48
|
+
|
|
49
|
+
const { sleeps, timers: listed } = (await niwa.call(LIST, {})) as { sleeps: string[]; timers: TimerEntity[] };
|
|
50
|
+
expect(sleeps).toEqual([]);
|
|
51
|
+
expect(listed.map((one) => String(one.name))).toEqual(["morning", "every:864000000", "once-later"]);
|
|
52
|
+
|
|
53
|
+
const morning = listed[0];
|
|
54
|
+
const lastMorning = firings.filter((row) => (row.data as { timer: string }).timer === "morning").at(-1)?.id;
|
|
55
|
+
expect(morning).toMatchObject({
|
|
56
|
+
name: "morning",
|
|
57
|
+
description: "the morning round",
|
|
58
|
+
schedule: { kind: "daily", time: "03:17" },
|
|
59
|
+
missed: "once",
|
|
60
|
+
nextDue: new Date(2024, 0, 4, 3, 17, 0, 0).getTime(),
|
|
61
|
+
lastFiring: lastMorning,
|
|
62
|
+
});
|
|
63
|
+
// A timer without a description is described by its schedule; one that has not fired has no last firing.
|
|
64
|
+
expect(listed[1]).toMatchObject({ description: "every 864000000ms", schedule: { kind: "every", ms: 10 * DAY_MS }, lastFiring: null });
|
|
65
|
+
expect(listed[2]).toMatchObject({ schedule: { kind: "at", at: start + 100 * DAY_MS }, missed: "skip", nextDue: start + 100 * DAY_MS, lastFiring: null });
|
|
66
|
+
|
|
67
|
+
expect(await niwa.call(GET, { name: "morning" })).toEqual(morning);
|
|
68
|
+
await expect(niwa.call(GET, { name: "nobody" })).rejects.toThrow('no timer "nobody"');
|
|
69
|
+
} finally {
|
|
70
|
+
await niwa.close();
|
|
71
|
+
await home.cleanup();
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test("a timer that is done has no next due, and the id of its last firing stays", async () => {
|
|
76
|
+
const home = await tempHome();
|
|
77
|
+
const start = 1_700_000_000_000;
|
|
78
|
+
const clock = testClock(start);
|
|
79
|
+
const niwa = createNiwa({ home: home.path, clock });
|
|
80
|
+
try {
|
|
81
|
+
niwa.use(timers([{ id: "once", at: start + 1000 }]));
|
|
82
|
+
await niwa.serve();
|
|
83
|
+
await clock.advance(2000);
|
|
84
|
+
const got = (await niwa.call(GET, { name: "once" })) as TimerEntity;
|
|
85
|
+
expect(got.nextDue).toBeNull();
|
|
86
|
+
expect(got.lastFiring).toBe(issueId("firing", seedOf("once", start + 1000), []));
|
|
87
|
+
} finally {
|
|
88
|
+
await niwa.close();
|
|
89
|
+
await home.cleanup();
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("the id of a firing is the same each time it is asked for, and a clash lengthens the hash of the later one", () => {
|
|
94
|
+
const issued: IssuedId[] = [];
|
|
95
|
+
const index = new IdIndex("firing", () => issued);
|
|
96
|
+
const first = firingId(index, timerId("a"), timestamp(1000));
|
|
97
|
+
issued.push({ id: first, seed: seedOf("a", 1000) });
|
|
98
|
+
expect(firingId(index, timerId("a"), timestamp(1000))).toBe(first);
|
|
99
|
+
expect(firingId(index, timerId("a"), timestamp(2000))).not.toBe(first);
|
|
100
|
+
expect(firingId(index, timerId("b"), timestamp(1000))).not.toBe(first);
|
|
101
|
+
|
|
102
|
+
// Another seed holds the six-digit id this one would take: it gets the longer cut.
|
|
103
|
+
const held: IssuedId[] = [{ id: first, seed: seedOf("other", 1) }];
|
|
104
|
+
const crowded = firingId(new IdIndex("firing", () => held), timerId("a"), timestamp(1000));
|
|
105
|
+
expect(crowded).toMatch(/^fire-[0-9a-f]{7}$/);
|
|
106
|
+
expect(crowded.startsWith(first)).toBe(true);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test("a description that is not a few words on one line is refused when the timers are made", () => {
|
|
110
|
+
expect(() => timers([{ id: "x", every: 1000, description: "no" }])).toThrow('timer "x" has a bad description');
|
|
111
|
+
expect(() => timers([{ id: "x", every: 1000, description: "a\nb two lines" }])).toThrow("bad description");
|
|
112
|
+
expect(() => timer.daily("09:00", { description: "x".repeat(61) })).not.toThrow();
|
|
113
|
+
expect(() => timers([timer.daily("09:00", { description: "x".repeat(61) })])).toThrow("bad description");
|
|
114
|
+
});
|