import { loadFixture, getPort, Nuxt } from '../utils' let port // const url = (route) => 'http://localhost:' + port + route let nuxt = null describe('children', () => { beforeAll(async () => { const options = await loadFixture('children') nuxt = new Nuxt(options) port = await getPort() await nuxt.server.listen(port, 'localhost') }) test('/parent', async () => { const { html } = await nuxt.server.renderRoute('/parent') expect(html).toContain('

I am the parent

') }) test('/parent/child', async () => { const { html } = await nuxt.server.renderRoute('/parent/child') expect(html).toContain('

I am the parent

') expect(html).toContain('

I am the child

') }) test('/parent should call _id.vue', async () => { const { html } = await nuxt.server.renderRoute('/parent') expect(html).toContain('

I am the parent

') expect(html).toContain('

Id=

') }) test('/parent/1', async () => { const { html } = await nuxt.server.renderRoute('/parent/1') expect(html).toContain('

I am the parent

') expect(html).toContain('

Id=1

') }) test('/parent/validate-child should display 404', async () => { const { html } = await nuxt.server.renderRoute('/parent/validate-child') expect(html).toContain('This page could not be found') }) test('/parent/validate-child?key=12345', async () => { const { html } = await nuxt.server.renderRoute('/parent/validate-child?key=12345') expect(html).toContain('

I am the parent

') expect(html).toContain('

Child valid

') }) // Close server and ask nuxt to stop listening to file changes afterAll(async () => { await nuxt.close() }) })