-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): Better error message in Webhook node when using the POST m…
…ethod
- Loading branch information
1 parent
5364a2d
commit a0dd17e
Showing
4 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { webhookNotFoundErrorMessage } from '../../src/utils'; | ||
|
||
describe('utils test webhookNotFoundErrorMessage ', () => { | ||
it('should return a message with path and method', () => { | ||
const message = webhookNotFoundErrorMessage('webhook12345', 'GET'); | ||
|
||
expect(message).toEqual('The requested webhook "GET webhook12345" is not registered.'); | ||
}); | ||
it('should return a message with path', () => { | ||
const message = webhookNotFoundErrorMessage('webhook12345'); | ||
|
||
expect(message).toEqual('The requested webhook "webhook12345" is not registered.'); | ||
}); | ||
it('should return a message with method with tip', () => { | ||
const message = webhookNotFoundErrorMessage('webhook12345', 'POST', ['GET', 'PUT']); | ||
|
||
expect(message).toEqual( | ||
'This webhook is not registered for POST requests. Did you mean to make a GET or PUT request?', | ||
); | ||
}); | ||
it('should return a message with method with tip', () => { | ||
const message = webhookNotFoundErrorMessage('webhook12345', 'POST', ['PUT']); | ||
|
||
expect(message).toEqual( | ||
'This webhook is not registered for POST requests. Did you mean to make a PUT request?', | ||
); | ||
}); | ||
it('should return a message with method with tip', () => { | ||
const message = webhookNotFoundErrorMessage('webhook12345', 'POST', ['GET', 'PUT', 'DELETE']); | ||
|
||
expect(message).toEqual( | ||
'This webhook is not registered for POST requests. Did you mean to make a GET, PUT or DELETE request?', | ||
); | ||
}); | ||
}); |