Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove questionable test #185

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
// })
})
})
Loading