Skip to content

Commit

Permalink
Add more detailed test case
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalLytek committed Aug 17, 2022
1 parent 0b40fb3 commit d2ecdc1
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/functional/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,25 @@ describe("Validation", () => {
expect(validationError.validationErrors[0].property).toEqual("numberField");
});

it("should throw validation error when one of optional items in the input array is incorrect", async () => {
it("should not throw error when one of optional items in the input array is null", async () => {
const mutation = `mutation {
mutationWithOptionalInputsArray(inputs: [
null,
{
stringField: "12345",
numberField: 5
},
]) {
field
}
}`;

const result = await graphql(schema, mutation);
expect(result.errors).toBeUndefined();
expect(result.data).toEqual({ mutationWithOptionalInputsArray: { field: null } });
});

it("should properly validate arg array when one of optional items in the input array is incorrect", async () => {
const mutation = `mutation {
mutationWithOptionalInputsArray(inputs: [
null,
Expand Down

0 comments on commit d2ecdc1

Please sign in to comment.