// Task 597 — memory-write stamps learnedAt on :TimelineEvent CREATE.
//
// Validates via source-content inspection (same pattern as
// memory-archive-write.test.ts and the registration gate tests): the Cypher
// query must contain `t.learnedAt = datetime()` inside the ON CREATE SET
// block, and it must appear within the same string as `HAS_TIMELINE_EVENT`.
import { describe, it, expect } from "vitest";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
const SRC = readFileSync(resolve(import.meta.dirname, "../memory-write.ts"), "utf-8");
describe("memory-write :TimelineEvent learnedAt stamp (Task 597)", () => {
    it("sets t.learnedAt = datetime() in the HAS_TIMELINE_EVENT ON CREATE SET block", () => {
        // Find the HAS_TIMELINE_EVENT query block in the source.
        const idx = SRC.indexOf("HAS_TIMELINE_EVENT");
        expect(idx).toBeGreaterThan(-1);
        // Slice 600 chars from the MERGE line. The ON CREATE SET block is ~350 chars
        // today; the 600-char window has ~250 chars of headroom for future additions.
        // If the block grows past 600 chars this assertion will need to widen.
        const window = SRC.slice(idx, idx + 600);
        expect(window).toContain("t.learnedAt = datetime()");
    });
    it("does not set learnedAt on ON MATCH (only on CREATE)", () => {
        const idx = SRC.indexOf("HAS_TIMELINE_EVENT");
        const window = SRC.slice(idx, idx + 600);
        // ON MATCH must not appear at all in this block — the node is immutable
        // after creation; learnedAt is a write-once transaction-time stamp.
        expect(window).not.toContain("ON MATCH SET");
    });
});
//# sourceMappingURL=memory-write-timeline-learned-at.test.js.map