chore: renames nested-docs test suite
This commit is contained in:
41
test/plugin-nested-docs/int.spec.ts
Normal file
41
test/plugin-nested-docs/int.spec.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import payload from '../../packages/payload/src'
|
||||
import { initPayloadTest } from '../helpers/configHelpers'
|
||||
|
||||
describe('Nested Docs', () => {
|
||||
beforeAll(async () => {
|
||||
await initPayloadTest({ __dirname, init: { local: true } })
|
||||
})
|
||||
|
||||
describe('seed', () => {
|
||||
it('should populate two levels of breadcrumbs', async () => {
|
||||
const query = await payload.find({
|
||||
collection: 'pages',
|
||||
where: {
|
||||
slug: {
|
||||
equals: 'child-page',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
expect(query.docs[0].breadcrumbs).toHaveLength(2)
|
||||
})
|
||||
|
||||
it('should populate three levels of breadcrumbs', async () => {
|
||||
const query = await payload.find({
|
||||
collection: 'pages',
|
||||
where: {
|
||||
slug: {
|
||||
equals: 'grandchild-page',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
expect(query.docs[0].breadcrumbs).toHaveLength(3)
|
||||
expect(query.docs[0].breadcrumbs[0].url).toStrictEqual('/parent-page')
|
||||
expect(query.docs[0].breadcrumbs[1].url).toStrictEqual('/parent-page/child-page')
|
||||
expect(query.docs[0].breadcrumbs[2].url).toStrictEqual(
|
||||
'/parent-page/child-page/grandchild-page',
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user