Created
March 2, 2021 19:16
-
-
Save billjohnston/72881acc2a6426ab0a045d58d1b8efff to your computer and use it in GitHub Desktop.
webhookrelay debug
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
curl https://1zfeu833kgom8kvdororgg.hooks.webhookrelay.com -X POST | |
curl https://my.webhookrelay.com/v1/webhooks/0d970bf0-9c84-440a-8013-6835287e6c7b -X POST |
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
yarn run v1.22.10 | |
$ NODE_PATH=./src ./node_modules/.bin/jest e2e | |
{"message":"subscribed to webhook stream successfully","level":"info"} | |
console.log | |
{ | |
type: 'status', | |
status: 'subscribed', | |
message: 'subscribed to buckets: 0d970bf0-9c84-440a-8013-6835287e6c7b' | |
} | |
at WebhookRelayClient._handler (src/e2eTest.test.ts:25:21) | |
{"message":"manual disconnect","level":"info"} | |
RUNS src/e2eTest.test.ts |
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
import { WebhookRelayClient } from 'webhookrelay-ws-client'; | |
const relayKey = 'blahblahblah'; | |
const relaySecret = 'blahblahblah'; | |
let client: WebhookRelayClient; | |
afterAll(() => { | |
if (client) { | |
client.disconnect(); | |
} | |
}); | |
test( | |
'e2e', | |
async () => { | |
const webhook = () => | |
new Promise((resolve, reject) => { | |
client = new WebhookRelayClient( | |
relayKey, | |
relaySecret, | |
['0d970bf0-9c84-440a-8013-6835287e6c7b'], | |
(data) => { | |
const parsed = JSON.parse(data); | |
console.log(parsed); | |
if (parsed.status !== 'subscribed') { | |
resolve(parsed); | |
} | |
client.disconnect(); | |
} | |
); | |
client.connect(); | |
}); | |
const res = await webhook(); | |
expect(res).toEqual({}); | |
}, | |
15 * 60 * 1000 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment