1
0
mirror of synced 2025-12-23 03:44:00 -05:00

Webhooks bugfix (#21374)

This commit is contained in:
Rachael Sewell
2021-09-09 16:25:43 -07:00
committed by GitHub
parent 55397df156
commit 9bf6afd13d
3 changed files with 82 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
import { jest } from '@jest/globals'
import { getDOM } from '../helpers/supertest.js'
import { allVersions } from '../../lib/all-versions.js'
describe('webhooks events and payloads', () => {
jest.setTimeout(300 * 1000)
describe('rendering', () => {
test('every webhook event has at least one payload example', async () => {
const versions = Object.values(allVersions).map((value) => value.version)
// For all versions, check that the webhook events and payloads page
// has at least one payload example for each event. Payload examples
// start with the id `webhook-payload-example` and have a sibling div
// with the class `height-constrained-code-block`. The sibling is
// usually but not always the next sibling element, which is why
// `nextUntil` is used.
for (const version of versions) {
const page = `/${version}/developers/webhooks-and-events/webhooks/webhook-events-and-payloads`
const $ = await getDOM(page)
const payloadExampleElem = $('[id^=webhook-payload-example]')
payloadExampleElem.each((i, elem) => {
const siblings = $(elem)
.nextUntil('[id^=webhook-payload-example]')
.filter((i, elem) => $(elem).hasClass('height-constrained-code-block'))
expect(siblings.length).toBeGreaterThan(0)
})
}
})
})
})