import { expect, test } from "vitest" import { FILE_INPUTOR_TYPE_NAME, FileInputorController } from "#Source/form/index.ts" test("FileInputorController.getSchema stores file values and reports file metadata", async () => { const file = new File(["alpha"], "alpha.txt", { type: "text/plain", }) const controller = new FileInputorController({ id: "file-id", value: file, }) await controller.waitForReady() const schema = await controller.getSchema() expect(schema.inputorTypeName).toBe(FILE_INPUTOR_TYPE_NAME) expect(schema.id).toBe("file-id") expect(schema.name).toBe("file-file-id") expect(schema.value?.name).toBe("alpha.txt") expect(schema.value?.type).toMatch(/^text\/plain(?:;.*)?$/) expect(schema.isDirty).toBe(false) })