Skip to content

Commit

Permalink
chore: fix the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielo515 committed Dec 7, 2023
1 parent 0c70eae commit 59c724b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/store/formStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("Form Engine", () => {
// Assert that the onSubmit callback is not called
expect(onSubmitMock).not.toHaveBeenCalled();
// Assert that the field has errors
expect(get(field1.errors)).toEqual(["fieldName1 is required"]);
expect(get(field1.errors)).toEqual(["'fieldName1' is required"]);
});
it("field errors should prefer field label over field name", () => {
const onSubmitMock = jest.fn();
Expand All @@ -59,7 +59,7 @@ describe("Form Engine", () => {
// Assert that the onSubmit callback is not called
expect(onSubmitMock).not.toHaveBeenCalled();
// Assert that the field has errors
expect(get(field1.errors)).toEqual(["Field Label is required"]);
expect(get(field1.errors)).toEqual(["'Field Label' is required"]);
});
it("Clears the errors when a value is set", () => {
const onSubmitMock = jest.fn();
Expand All @@ -75,7 +75,7 @@ describe("Form Engine", () => {
formEngine.triggerSubmit();
expect(get(formEngine.isValid)).toBe(false);
expect(onSubmitMock).not.toHaveBeenCalled();
expect(get(field1.errors)).toEqual(["Field Label is required"]);
expect(get(field1.errors)).toEqual(["'Field Label' is required"]);
// Set the field value, clearing the errors
field1.value.set("value");
// Assert that the field errors are cleared
Expand Down

0 comments on commit 59c724b

Please sign in to comment.