diff --git a/test/resources/error-handling/i18n/messages_en.properties b/test/resources/error-handling/i18n/messages_en.properties index 82da859d..7460e6a1 100644 --- a/test/resources/error-handling/i18n/messages_en.properties +++ b/test/resources/error-handling/i18n/messages_en.properties @@ -1,2 +1 @@ -ORDER_EXCEEDS_STOCK=The order of {0} books exceeds the stock by {1} -ORDER_EXCEEDS_STOCK_NO_ARGS=The order of books exceeds the stock \ No newline at end of file +ORDER_EXCEEDS_STOCK=The order of {0} books exceeds the stock by {1} \ No newline at end of file diff --git a/test/resources/error-handling/srv/custom-handler-errors.js b/test/resources/error-handling/srv/custom-handler-errors.js index 4b58fe47..d50fd427 100644 --- a/test/resources/error-handling/srv/custom-handler-errors.js +++ b/test/resources/error-handling/srv/custom-handler-errors.js @@ -72,7 +72,6 @@ module.exports = srv => { if (id === 1) req.reject(400, message, args) if (id === 2) req.reject(code, message, args) - req.reject('ORDER_EXCEEDS_STOCK_NO_ARGS') } }) } diff --git a/test/tests/error-handling-dev.test.js b/test/tests/error-handling-dev.test.js index ae21adc2..136bbf8e 100644 --- a/test/tests/error-handling-dev.test.js +++ b/test/tests/error-handling-dev.test.js @@ -347,7 +347,7 @@ describe('graphql - error handling in development', () => { message: 'Some Custom Error Message 1', numericSeverity: 4, status: 418, - target: 'some_field', + target: 'some_field' // stack: expect.any(String) // doesn't work with Node 22 }, { @@ -355,7 +355,7 @@ describe('graphql - error handling in development', () => { message: 'Some Custom Error Message 2', numericSeverity: 4, status: 500, - target: 'some_field', + target: 'some_field' // stack: expect.any(String) // doesn't work with Node 22 } ] @@ -452,34 +452,5 @@ describe('graphql - error handling in development', () => { expect(response.data).toMatchObject({ errors }) 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 books exceeds the stock', - 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 - }) }) })