feat: updated integration page with missing API routes
This commit is contained in:
1 parent
25d9c30b8a
commit
7c0ee21906
25 files changed
+2402
-350
No files matched your search
@@ -344,13 +344,20 @@ describe('8c Typing media', () => {
|
||||
|
||||
expect(groupTitles()).toEqual(['Endpoints', 'Sections'])
|
||||
const rows = optionRoutes()
|
||||
expect(rows.slice(0, 6).every((route) => route!.includes('/v1/media'))).toBe(true)
|
||||
expect(rows.slice(0, 6)).toEqual([
|
||||
'GET /v1/builtin-type/',
|
||||
'GET /v1/media/',
|
||||
'GET /v1/media/{id}',
|
||||
'POST /v1/media/',
|
||||
'PATCH /v1/media/{id}',
|
||||
'DELETE /v1/media/{id}',
|
||||
])
|
||||
expect(rows.at(-1)).toBe('Section Media')
|
||||
expect(options().at(-1)!.textContent).toContain('11 routes')
|
||||
expect(document.body.textContent).toContain('12 results')
|
||||
expect(liveRegion()).toBe('12 results, showing 7')
|
||||
expect(document.body.textContent).toContain('17 results')
|
||||
expect(liveRegion()).toBe('17 results, showing 7')
|
||||
expect(document.body.textContent).toContain(
|
||||
'5 more endpoints. Keep typing to narrow the list.',
|
||||
'10 more endpoints. Keep typing to narrow the list.',
|
||||
)
|
||||
const marks = Array.from(document.body.querySelectorAll('[role="option"] mark'))
|
||||
expect(marks.length).toBeGreaterThan(0)
|
||||
@@ -374,12 +381,11 @@ describe('8d More endpoints than the cap', () => {
|
||||
expect(options().at(-1)!.getAttribute('aria-label')).toBe(
|
||||
'Section Errors. Status codes and messages',
|
||||
)
|
||||
const total = Number(/(\d+) results/.exec(document.body.textContent!)![1])
|
||||
expect(total).toBeGreaterThan(7)
|
||||
expect(document.body.textContent).toContain('24 results')
|
||||
expect(document.body.textContent).toContain(
|
||||
`${total - 7} more endpoints. Keep typing to narrow the list.`,
|
||||
'17 more endpoints. Keep typing to narrow the list.',
|
||||
)
|
||||
expect(liveRegion()).toBe(`${total} results, showing 7`)
|
||||
expect(liveRegion()).toBe('24 results, showing 7')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -434,7 +440,7 @@ describe('8f Session-only route', () => {
|
||||
expect(path.classList.contains('font-normal')).toBe(true)
|
||||
expect(route!.innerHTML).toContain('border-dashed')
|
||||
expect(section!.getAttribute('aria-label')).toBe(
|
||||
'Section Session only. 25 routes, not available to API keys',
|
||||
'Section Session only. 37 routes, not available to API keys',
|
||||
)
|
||||
expect(section!.querySelector('svg')).not.toBeNull()
|
||||
expect(document.body.textContent).toContain('2 results')
|
||||
@@ -551,6 +557,91 @@ describe('Roles and live region', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('9f to 9i Content types and entries', () => {
|
||||
async function searchFor(query: string) {
|
||||
const wrapper = await mountIntegration()
|
||||
await openWithSlash()
|
||||
await type(query)
|
||||
return wrapper
|
||||
}
|
||||
|
||||
it('9f lists the entry routes, matches "entries" and caps with the plural line', async () => {
|
||||
await searchFor('entry')
|
||||
|
||||
expect(groupTitles()).toEqual(['Endpoints', 'Sections'])
|
||||
expect(optionRoutes()).toEqual([
|
||||
'GET /v1/content-type/{key}/entry',
|
||||
'POST /v1/content-type/{key}/entry',
|
||||
'GET /v1/content-type/{key}/entry/{id}',
|
||||
'PUT /v1/content-type/{key}/entry/{id}',
|
||||
'DELETE /v1/content-type/{key}/entry/{id}',
|
||||
'PUT /v1/content-type/{key}',
|
||||
'Section Entries',
|
||||
])
|
||||
expect(document.body.textContent).toContain('8 results')
|
||||
expect(liveRegion()).toBe('8 results, showing 7')
|
||||
expect(document.body.textContent).toContain(
|
||||
'1 more endpoint. Keep typing to narrow the list.',
|
||||
)
|
||||
expect(document.body.textContent).not.toContain('1 more endpoints')
|
||||
})
|
||||
|
||||
it('9g labels the capacity key as a Body field on POST and PUT entry', async () => {
|
||||
await searchFor('capacity')
|
||||
|
||||
expect(optionRoutes()).toEqual([
|
||||
'POST /v1/content-type/{key}/entry',
|
||||
'PUT /v1/content-type/{key}/entry/{id}',
|
||||
])
|
||||
for (const row of options()) {
|
||||
expect(row.textContent).toContain('Body field')
|
||||
expect(row.querySelector('mark')!.textContent).toBe('capacity')
|
||||
}
|
||||
expect(document.body.textContent).toContain('2 results')
|
||||
expect(liveRegion()).toBe('2 results')
|
||||
})
|
||||
|
||||
it('9h labels schema_incompatible as an Error on PUT /v1/content-type/{key}', async () => {
|
||||
await searchFor('schema_incompatible')
|
||||
|
||||
expect(optionRoutes()).toEqual(['PUT /v1/content-type/{key}'])
|
||||
expect(options()[0]!.textContent).toContain('Error')
|
||||
expect(options()[0]!.textContent).toContain('409 schema_incompatible')
|
||||
expect(liveRegion()).toBe('1 result')
|
||||
})
|
||||
|
||||
it('9i lists Content types and Entries in the Sections group', async () => {
|
||||
await searchFor('content type')
|
||||
|
||||
expect(groupTitles()).toEqual(['Endpoints', 'Sections'])
|
||||
expect(optionRoutes().slice(-2)).toEqual(['Section Content types', 'Section Entries'])
|
||||
expect(options()).toHaveLength(8)
|
||||
expect(document.body.textContent).toContain('12 results')
|
||||
expect(liveRegion()).toBe('12 results, showing 8')
|
||||
})
|
||||
|
||||
it('selects PUT /v1/content-type/{key}, expands it, flashes it and reads Content types', async () => {
|
||||
const wrapper = await searchFor('schema_incompatible')
|
||||
await pressInPalette('Enter')
|
||||
await wrapper.vm.$nextTick()
|
||||
await settle()
|
||||
|
||||
const button = cardFor(wrapper, 'ct-update').get('button[aria-expanded]')
|
||||
expect(paletteOpen()).toBe(false)
|
||||
expect(button.attributes('aria-expanded')).toBe('true')
|
||||
expect(document.activeElement).toBe(button.element)
|
||||
expect(button.classes()).toContain('endpoint-flash')
|
||||
expect(window.location.hash).toBe('#ep-ct-update')
|
||||
const index = wrapper.get('nav[aria-label="On this page"]')
|
||||
expect(index.get('button[aria-current="true"]').text()).toBe('Content types')
|
||||
|
||||
await vi.advanceTimersByTimeAsync(FLASH_MS)
|
||||
await flushPromises()
|
||||
|
||||
expect(button.classes()).not.toContain('endpoint-flash')
|
||||
})
|
||||
})
|
||||
|
||||
describe('8h Selecting an endpoint', () => {
|
||||
async function selectMerge(wrapper: VueWrapper, how: 'enter' | 'click') {
|
||||
await openWithSlash()
|
||||
|
||||
Reference in new issue
Block a user