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
@@ -51,18 +51,27 @@ describe('index', () => {
|
||||
'auth',
|
||||
'articles',
|
||||
'seo',
|
||||
'ctypes',
|
||||
'entries',
|
||||
'builtin',
|
||||
'media',
|
||||
'sites',
|
||||
'images',
|
||||
'users',
|
||||
'settings',
|
||||
'sites',
|
||||
'authors',
|
||||
'images',
|
||||
'session',
|
||||
'errors',
|
||||
'notes',
|
||||
])
|
||||
})
|
||||
|
||||
it('holds 85 endpoints: 42 documented, 37 session only and 6 public auth', () => {
|
||||
expect(index.endpoints).toHaveLength(85)
|
||||
expect(index.endpoints.filter((entry) => entry.cardId !== null)).toHaveLength(42)
|
||||
expect(index.endpoints.filter((entry) => entry.session)).toHaveLength(37)
|
||||
expect(index.endpoints.filter((entry) => entry.key.startsWith('public:'))).toHaveLength(6)
|
||||
})
|
||||
|
||||
it('never indexes code samples or response examples', () => {
|
||||
expect(search('rcms_kf3x').endpoints.map((hit) => hit.entry.key)).toEqual([])
|
||||
expect(search('"total"').endpoints).toEqual([])
|
||||
@@ -164,12 +173,13 @@ describe('matching', () => {
|
||||
it('finds sections by title, description and keywords', () => {
|
||||
expect(routes(search('media').sections)).toEqual(['section Media'])
|
||||
expect(search('media').sections[0]!.entry).toMatchObject({ description: '11 routes' })
|
||||
expect(search('media').sections[0]!.entry.sectionId).toBe('media')
|
||||
const login = search('login')
|
||||
expect(routes(login.endpoints)).toEqual(['POST /v1/auth/login'])
|
||||
expect(routes(login.sections)).toEqual(['section Session only'])
|
||||
expect(login.sections[0]!.entry).toMatchObject({
|
||||
locked: true,
|
||||
description: '25 routes, not available to API keys',
|
||||
description: '37 routes, not available to API keys',
|
||||
})
|
||||
})
|
||||
|
||||
@@ -189,6 +199,58 @@ describe('matching', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('custom content types', () => {
|
||||
it.each([
|
||||
['media', 16, 1],
|
||||
['404', 23, 1],
|
||||
['login', 1, 1],
|
||||
['entry', 7, 1],
|
||||
['capacity', 2, 0],
|
||||
['schema_incompatible', 1, 0],
|
||||
['content type', 10, 2],
|
||||
])('counts "%s" as %i endpoints and %i sections', (query, endpoints, sections) => {
|
||||
const result = search(query)
|
||||
expect(result.endpoints).toHaveLength(endpoints)
|
||||
expect(result.sections).toHaveLength(sections)
|
||||
})
|
||||
|
||||
it('also matches "entries" for the term entry, in text and in highlights', () => {
|
||||
const keys = search('entry').endpoints.map((hit) => hit.entry.key)
|
||||
expect(keys).toContain('ep:ct-delete')
|
||||
expect(keys).toContain('ep:ct-update')
|
||||
expect(routes(search('entry').sections)).toEqual(['section Entries'])
|
||||
expect(highlightSegments('Entries and entry', ['entry'])).toEqual([
|
||||
{ text: 'Entries', marked: true },
|
||||
{ text: ' and ', marked: false },
|
||||
{ text: 'entry', marked: true },
|
||||
])
|
||||
})
|
||||
|
||||
it('labels the events keys as body fields and a code as an error', () => {
|
||||
const capacity = search('capacity').endpoints
|
||||
expect(capacity.map((hit) => hit.via?.kind)).toEqual(['body', 'body'])
|
||||
expect(search('starts_on').endpoints.map((hit) => hit.via)).toEqual([
|
||||
{ kind: 'body', text: 'starts_on' },
|
||||
{ kind: 'body', text: 'starts_on' },
|
||||
])
|
||||
const [schema] = search('schema_incompatible').endpoints
|
||||
expect(schema!.via!.kind).toBe('error')
|
||||
expect(schema!.via!.text.startsWith('409 schema_incompatible')).toBe(true)
|
||||
expect(routes(search('schema_incompatible').endpoints)).toEqual([
|
||||
'PUT /v1/content-type/{key}',
|
||||
])
|
||||
})
|
||||
|
||||
it('finds the new sections by their keywords', () => {
|
||||
expect(routes(search('schema').sections)).toEqual([
|
||||
'section Content types',
|
||||
'section Built-in types',
|
||||
])
|
||||
expect(routes(search('author').sections)).toContain('section Sites and authors')
|
||||
expect(routes(search('purge').sections)).toEqual(['section Media'])
|
||||
})
|
||||
})
|
||||
|
||||
describe('suggestions', () => {
|
||||
it('lists the five suggested rows in order', () => {
|
||||
expect(routes(suggestedHits(index))).toEqual([
|
||||
|
||||
Reference in new issue
Block a user