Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 3, 2020
1 parent 7997b9b commit 39b8172
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/dev/modern.client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('modern client mode (SSR)', () => {
test('should contain nomodule legacy resources', async () => {
const { body: response } = await rp(url('/'))
expect(response).toContain('script nomodule crossorigin="use-credentials" src="/_nuxt/app.js')
expect(response).toContain('script nomodule crossorigin="use-credentials" src="/_nuxt/vendors/commons.js')
expect(response).toContain('script nomodule crossorigin="use-credentials" src="/_nuxt/commons.js')
})

test('should contain module modern resources', async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/dev/modern.server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('modern server mode', () => {
test('should use legacy resources by default', async () => {
const { body: response } = await rp(url('/'))
expect(response).toContain('/_nuxt/app.js')
expect(response).toContain('/_nuxt/vendors/commons.js')
expect(response).toContain('/_nuxt/commons.js')
})

test('should use modern resources for modern resources', async () => {
Expand All @@ -47,7 +47,7 @@ describe('modern server mode', () => {
const { headers: { link } } = await rp(url('/'))
expect(link).toEqual([
'</_nuxt/runtime.js>; rel=preload; crossorigin=use-credentials; as=script',
'</_nuxt/vendors/commons.js>; rel=preload; crossorigin=use-credentials; as=script',
'</_nuxt/commons.js>; rel=preload; crossorigin=use-credentials; as=script',
'</_nuxt/app.js>; rel=preload; crossorigin=use-credentials; as=script',
`</_nuxt/${wChunk('pages/index.js')}>; rel=preload; crossorigin=use-credentials; as=script`
].join(', '))
Expand Down
6 changes: 3 additions & 3 deletions test/dev/modern.spa.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('modern client mode (SPA)', () => {
test('should contain nomodule legacy resources', async () => {
const { body: response } = await rp(url('/'))
expect(response).toContain('src="/_nuxt/app.js" crossorigin="use-credentials" nomodule')
expect(response).toContain('src="/_nuxt/vendors/commons.js" crossorigin="use-credentials" nomodule')
expect(response).toContain('src="/_nuxt/commons.js" crossorigin="use-credentials" nomodule')
})

test('should contain module modern resources', async () => {
Expand All @@ -36,14 +36,14 @@ describe('modern client mode (SPA)', () => {
test('should contain legacy preload resources', async () => {
const { body: response } = await rp(url('/'))
expect(response).toContain('<link rel="preload" crossorigin="use-credentials" href="/_nuxt/app.js" as="script">')
expect(response).toContain('<link rel="preload" crossorigin="use-credentials" href="/_nuxt/vendors/commons.js" as="script">')
expect(response).toContain('<link rel="preload" crossorigin="use-credentials" href="/_nuxt/commons.js" as="script">')
})

test('should contain legacy http2 pushed resources', async () => {
const { headers: { link } } = await rp(url('/'))
expect(link).toEqual([
'</_nuxt/runtime.js>; rel=preload; crossorigin=use-credentials; as=script',
'</_nuxt/vendors/commons.js>; rel=preload; crossorigin=use-credentials; as=script',
'</_nuxt/commons.js>; rel=preload; crossorigin=use-credentials; as=script',
'</_nuxt/app.js>; rel=preload; crossorigin=use-credentials; as=script'
].join(', '))
})
Expand Down
2 changes: 1 addition & 1 deletion test/dev/spa.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function spaTests ({ isHashMode }) {
test('/ (include preload and prefetch resources)', async () => {
const { head } = await renderRoute('/')
expect(head).toMatch('<link rel="preload" href="/_nuxt/runtime.js" as="script">')
expect(head).toMatch('<link rel="preload" href="/_nuxt/vendors/commons.js" as="script">')
expect(head).toMatch('<link rel="preload" href="/_nuxt/commons.js" as="script">')
expect(head).toMatch('<link rel="preload" href="/_nuxt/app.js" as="script">')
expect(head).toMatch(`<link rel="prefetch" href="/_nuxt/${wChunk('pages/custom.js')}">`)
expect(head).toMatch(`<link rel="prefetch" href="/_nuxt/${wChunk('pages/error-handler-async.js')}">`)
Expand Down

0 comments on commit 39b8172

Please sign in to comment.