it.effect("should mutation input argument be invalid", () =>
Effect.gen(function* () {
// Act
const result = yield* testGraphql(
portfolioUpdate,
{ input: { id: "123", name: "new name" } },
adminPermissions
);
// Assert
expect(result).toStrictEqual({
data: null,
errors: [
new GraphQLError(
`Error: Validation ({ readonly id: (string | number <-> ObjectId); readonly name?: a non empty string | null | undefined; readonly positionsInAmount?: boolean | null | undefined } <-> { readonly _id: ObjectId; readonly name?: string | undefined; readonly positions_in_amount?: boolean | undefined })
└─ Encoded side transformation failure
└─ { readonly id: (string | number <-> ObjectId); readonly name?: a non empty string | null | undefined; readonly positionsInAmount?: boolean | null | undefined }
└─ ["id"]
└─ (string | number <-> ObjectId)
└─ Transformation process failure
└─ input must be a 24 character hex string, 12 byte Uint8Array, or an integer`
),
],
});
}).pipe(Effect.provide(TestLayer))
);
it.effect("should mutation input argument be invalid", () =>
Effect.gen(function* () {
// Act
const result = yield* testGraphql(
portfolioUpdate,
{ input: { id: "123", name: "new name" } },
adminPermissions
);
// Assert
expect(result).toStrictEqual({
data: null,
errors: [
new GraphQLError(
`Error: Validation ({ readonly id: (string | number <-> ObjectId); readonly name?: a non empty string | null | undefined; readonly positionsInAmount?: boolean | null | undefined } <-> { readonly _id: ObjectId; readonly name?: string | undefined; readonly positions_in_amount?: boolean | undefined })
└─ Encoded side transformation failure
└─ { readonly id: (string | number <-> ObjectId); readonly name?: a non empty string | null | undefined; readonly positionsInAmount?: boolean | null | undefined }
└─ ["id"]
└─ (string | number <-> ObjectId)
└─ Transformation process failure
└─ input must be a 24 character hex string, 12 byte Uint8Array, or an integer`
),
],
});
}).pipe(Effect.provide(TestLayer))
);