Nuxt/packages/generator/test/__utils__/index.js
Pooya Parsa a82f8d8b1f
feat(generator): export:route hook and setPayload (#7422)
* feat(generator): shared payload support for `nuxt export`

* feat: add `export:` hooks for upward compatibility

* fix: use setPayload to avoid breaking usage

* test: update test

* fix: deep assign

* chore: update tests

* fix: route payload has more periority than shared one

* test: update generator hook tests

* lint: remove unnecessary import
2020-05-27 16:51:51 +02:00

21 lines
527 B
JavaScript

export const createNuxt = () => ({
ready: jest.fn(),
callHook: jest.fn(),
server: {
renderRoute: jest.fn(() => ({ html: 'rendered html' }))
},
options: {
mode: 'universal',
srcDir: '/var/nuxt/src',
buildDir: '/var/nuxt/build',
generate: { dir: '/var/nuxt/generate' },
build: { publicPath: '__public' },
dir: { static: '/var/nuxt/static' },
render: {}
}
})
export function hookCalls (nuxt, name) {
return nuxt.callHook.mock.calls.filter(c => c[0] === name).map(c => c.splice(1))
}