refactor(runtime): centralize lifecycle constants
This commit is contained in:
1 parent
e540cbb2a6
commit
fa006524c2
6 files changed
+49
-14
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { AppDatabase } from "../../src/main/database";
|
||||
import {
|
||||
DOCUMENT_LIFECYCLE_PROCESSOR_DEFAULTS,
|
||||
STALE_LOCK_TIMEOUT_MS,
|
||||
} from "../../src/main/constants";
|
||||
import { makeLifecycleProcessorOptions } from "../../src/main/document-lifecycle-processor";
|
||||
|
||||
describe("runtime constants", () => {
|
||||
it("uses one stale lock timeout for task lease recovery", () => {
|
||||
expect(STALE_LOCK_TIMEOUT_MS).toBe(15 * 60 * 1000);
|
||||
});
|
||||
|
||||
it("uses shared document lifecycle processor defaults", () => {
|
||||
const logger = { info: () => undefined, warn: () => undefined, error: () => undefined };
|
||||
const options = makeLifecycleProcessorOptions({
|
||||
db: {} as AppDatabase,
|
||||
logger,
|
||||
});
|
||||
|
||||
expect(options.maxAttempts).toBe(DOCUMENT_LIFECYCLE_PROCESSOR_DEFAULTS.maxAttempts);
|
||||
expect(options.staleRunningMs).toBe(DOCUMENT_LIFECYCLE_PROCESSOR_DEFAULTS.staleRunningMs);
|
||||
expect(options.batchSize).toBe(DOCUMENT_LIFECYCLE_PROCESSOR_DEFAULTS.batchSize);
|
||||
expect(options.sweepIntervalMs).toBe(DOCUMENT_LIFECYCLE_PROCESSOR_DEFAULTS.sweepIntervalMs);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user