evOo-local/packages/adapters/src/current-time.test.ts
cynarAI 6c7eed7580 Initial clean evOo-local from f00577b
Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline
(Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/*
packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
2026-09-20 17:15:16 +02:00

26 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { formatCurrentTimeInstruction } from "./current-time.js";
describe("formatCurrentTimeInstruction", () => {
it("anchors the present moment in UTC with the weekday and no sub-second noise", () => {
const line = formatCurrentTimeInstruction(new Date("2026-09-17T14:55:41.123Z"));
expect(line).toContain("Current date and time: Thursday, 2026-09-17T14:55:41Z (UTC).");
expect(line).not.toContain(".123");
});
it("tells the model not to guess the date from training data or quoted timestamps", () => {
const line = formatCurrentTimeInstruction(new Date("2026-01-01T00:00:00Z"));
expect(line).toContain("Never infer today's date from your training data");
expect(line).toContain("write absolute dates");
});
it("defaults to the real clock", () => {
const before = Date.now();
const line = formatCurrentTimeInstruction();
const match = /(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})Z/.exec(line);
expect(match).not.toBeNull();
const stamped = Date.parse(`${match![1]}Z`);
expect(Math.abs(stamped - before)).toBeLessThan(5_000);
});
});