refactor: adapter 구현중..
This commit is contained in:
@@ -42,6 +42,25 @@ afterEach(async () => {
|
||||
});
|
||||
|
||||
describe("validated JSON artifact writer", () => {
|
||||
it("returns the exact schema-validated bytes used by durable publication", async () => {
|
||||
const artifact = await import("../../scripts/lib/validated-json-artifact.ts") as
|
||||
Record<string, unknown>;
|
||||
expect(artifact.serializeValidatedJsonArtifact).toBeTypeOf("function");
|
||||
const serializeValidatedJsonArtifact = artifact.serializeValidatedJsonArtifact as (
|
||||
input: Readonly<{ path: string; schema: z.ZodType; value: unknown }>,
|
||||
) => Buffer;
|
||||
expect(serializeValidatedJsonArtifact({
|
||||
path: "/unused/artifact.json",
|
||||
schema: z.object({ value: z.string() }).strict(),
|
||||
value: { value: "sealed" },
|
||||
})).toEqual(Buffer.from('{\n "value": "sealed"\n}\n'));
|
||||
expect(() => serializeValidatedJsonArtifact({
|
||||
path: "/unused/artifact.json",
|
||||
schema: z.object({ value: z.string() }).strict(),
|
||||
value: { value: 7 },
|
||||
})).toThrow();
|
||||
});
|
||||
|
||||
it("syncs an O_NOFOLLOW exclusive temp and its directory around rename", async () => {
|
||||
const events: string[] = [];
|
||||
let openFlags = 0;
|
||||
|
||||
Reference in New Issue
Block a user