Skip to content

Commit

Permalink
chore: remove questionable test
Browse files Browse the repository at this point in the history
  • Loading branch information
danjoa committed Oct 7, 2024
1 parent 53a8a80 commit b8ce92e
Showing 1 changed file with 29 additions and 28 deletions.
57 changes: 29 additions & 28 deletions test/tests/error-handling-dev.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,33 +453,34 @@ describe('graphql - error handling in development', () => {
expect(response.data.errors[0].extensions.stacktrace).not.toHaveLength(0) // Stacktrace exists and is not empty
})

test('req.reject with custom code', async () => {
const query = gql`
mutation {
CustomHandlerErrorsService {
Orders {
create(input: { id: 3, quantity: 20, stock: 10 }) {
id
quantity
stock
}
}
}
}
`
const errors = [
{
message: 'The order of NULL books exceeds the stock by NULL',
extensions: {
code: '500',
numericSeverity: 4,
stacktrace: expect.any(Array)
}
}
]
const response = await POST('/graphql', { query })
expect(response.data).toMatchObject({ errors })
expect(response.data.errors[0].extensions.stacktrace).not.toHaveLength(0) // Stacktrace exists and is not empty
})
// NOTE: Never do such tests: it doesn't check expected behavior but just documents actual one which can change
// test('req.reject with custom code', async () => {
// const query = gql`
// mutation {
// CustomHandlerErrorsService {
// Orders {
// create(input: { id: 3, quantity: 20, stock: 10 }) {
// id
// quantity
// stock
// }
// }
// }
// }
// `
// const errors = [
// {
// message: 'The order of NULL books exceeds the stock by NULL',
// extensions: {
// code: '500',
// numericSeverity: 4,
// stacktrace: expect.any(Array)
// }
// }
// ]
// const response = await POST('/graphql', { query })
// expect(response.data).toMatchObject({ errors })
// expect(response.data.errors[0].extensions.stacktrace).not.toHaveLength(0) // Stacktrace exists and is not empty
// })
})
})

0 comments on commit b8ce92e

Please sign in to comment.