Replace inline data-URL image handling with a persistent attachment storage service, add draft lifecycle states (active/abandoned/sent) with generation tracking, and update fetchAgent to return project placement alongside agent snapshots.
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { shouldSkipDraftPersist } from "./agent-input-area.draft-persist-guard";
|
|
|
|
describe("shouldSkipDraftPersist", () => {
|
|
it("blocks persist while hydrate for current uncontrolled generation is incomplete", () => {
|
|
expect(
|
|
shouldSkipDraftPersist({
|
|
isControlled: false,
|
|
currentGeneration: 2,
|
|
hydratedGeneration: 1,
|
|
isCurrentGeneration: true,
|
|
})
|
|
).toBe(true);
|
|
});
|
|
|
|
it("allows persist after hydrate completes for current generation", () => {
|
|
expect(
|
|
shouldSkipDraftPersist({
|
|
isControlled: false,
|
|
currentGeneration: 3,
|
|
hydratedGeneration: 3,
|
|
isCurrentGeneration: true,
|
|
})
|
|
).toBe(false);
|
|
});
|
|
|
|
it("blocks persist for stale generations", () => {
|
|
expect(
|
|
shouldSkipDraftPersist({
|
|
isControlled: false,
|
|
currentGeneration: 4,
|
|
hydratedGeneration: 4,
|
|
isCurrentGeneration: false,
|
|
})
|
|
).toBe(true);
|
|
});
|
|
|
|
it("does not block controlled draft persistence", () => {
|
|
expect(
|
|
shouldSkipDraftPersist({
|
|
isControlled: true,
|
|
currentGeneration: 0,
|
|
hydratedGeneration: 0,
|
|
isCurrentGeneration: true,
|
|
})
|
|
).toBe(false);
|
|
});
|
|
});
|