diff --git a/src/core/formDataFromDefaults.test.ts b/src/core/formDataFromDefaults.test.ts index d25c574e..c53c9a78 100644 --- a/src/core/formDataFromDefaults.test.ts +++ b/src/core/formDataFromDefaults.test.ts @@ -16,6 +16,7 @@ describe("formDataFromFormOptions", () => { input: { type: "multiselect", source: "fixed", + allowUnknownValues: false, multi_select_options: ["reading", "swimming", "running"], }, }, @@ -61,7 +62,7 @@ describe("formDataFromFormOptions", () => { expect(result).toEqual(expectedFormData); }); - it("should ensure toggles always have avalue even when no values are provided", () => { + it("should ensure toggles always have a value even when no values are provided", () => { const values = {}; const expectedFormData = { isEmployed: false }; diff --git a/src/core/formDefinition.test.ts b/src/core/formDefinition.test.ts index 6526ac47..4351b33c 100644 --- a/src/core/formDefinition.test.ts +++ b/src/core/formDefinition.test.ts @@ -10,35 +10,25 @@ import { parse } from "valibot"; describe("isDataViewSource", () => { it("should return true for valid inputDataviewSource objects", () => { - expect( - isDataViewSource({ type: "dataview", query: "some query" }), - ).toBe(true); + expect(isDataViewSource({ type: "dataview", query: "some query" })).toBe(true); }); it("should return false for invalid inputDataviewSource objects", () => { expect(isDataViewSource({ type: "dataview" })).toBe(false); expect(isDataViewSource({ type: "dataview", query: 123 })).toBe(false); - expect(isDataViewSource({ type: "select", query: "some query" })).toBe( - false, - ); + expect(isDataViewSource({ type: "select", query: "some query" })).toBe(false); }); }); describe("isInputNoteFromFolder", () => { it("should return true for valid inputNoteFromFolder objects", () => { - expect( - isInputNoteFromFolder({ type: "note", folder: "some folder" }), - ).toBe(true); + expect(isInputNoteFromFolder({ type: "note", folder: "some folder" })).toBe(true); }); it("should return false for invalid inputNoteFromFolder objects", () => { expect(isInputNoteFromFolder({ type: "note" })).toBe(false); - expect(isInputNoteFromFolder({ type: "note", folder: 123 })).toBe( - false, - ); - expect( - isInputNoteFromFolder({ type: "select", folder: "some folder" }), - ).toBe(false); + expect(isInputNoteFromFolder({ type: "note", folder: 123 })).toBe(false); + expect(isInputNoteFromFolder({ type: "select", folder: "some folder" })).toBe(false); }); }); @@ -54,9 +44,7 @@ describe("isInputSelectFixed", () => { }); it("should return false for invalid inputSelectFixed objects", () => { - expect(isInputSelectFixed({ type: "select", source: "fixed" })).toBe( - false, - ); + expect(isInputSelectFixed({ type: "select", source: "fixed" })).toBe(false); expect( isInputSelectFixed({ type: "select", @@ -81,9 +69,7 @@ describe("isInputSlider", () => { it("should return false for invalid inputSlider objects", () => { expect(isInputSlider({ type: "slider" })).toBe(false); - expect(isInputSlider({ type: "slider", min: "0", max: 10 })).toBe( - false, - ); + expect(isInputSlider({ type: "slider", min: "0", max: 10 })).toBe(false); expect(isInputSlider({ type: "select", min: 0, max: 10 })).toBe(false); }); }); @@ -100,15 +86,9 @@ describe("isSelectFromNotes", () => { }); it("should return false for invalid selectFromNotes objects", () => { - expect(isSelectFromNotes({ type: "select", source: "notes" })).toBe( - false, - ); - expect( - isSelectFromNotes({ type: "select", source: "notes", folder: 123 }), - ).toBe(false); - expect(isSelectFromNotes({ type: "note", folder: "some folder" })).toBe( - false, - ); + expect(isSelectFromNotes({ type: "select", source: "notes" })).toBe(false); + expect(isSelectFromNotes({ type: "select", source: "notes", folder: 123 })).toBe(false); + expect(isSelectFromNotes({ type: "note", folder: "some folder" })).toBe(false); }); }); describe("MultiSelectFixedSchema", () => { @@ -118,7 +98,10 @@ describe("MultiSelectFixedSchema", () => { source: "fixed", multi_select_options: ["Option 1", "Option 2", "Option 3"], }; - expect(parse(MultiselectSchema, validSchema)).toEqual(validSchema); + expect(parse(MultiselectSchema, validSchema)).toEqual({ + allowUnknownValues: false, + ...validSchema, + }); }); it("should not validate an invalid multiselect fixed schema with missing properties", () => {