diff --git a/packages/blocks/test/nuxt/index.test.js b/packages/blocks/test/nuxt/index.test.js new file mode 100644 index 000000000..c4d8e37a7 --- /dev/null +++ b/packages/blocks/test/nuxt/index.test.js @@ -0,0 +1,25 @@ +import DruxtBlocksNuxtModule from '../../src/nuxt' + +// jest.mock('../src/nuxt/storybook') + +jest.mock('@nuxt/kit', () => ({ + defineNuxtModule: (module) => module, + installModule: jest.fn(), +})) + +const nuxtMock = { + hook: jest.fn((hook, fn) => { + const arg = { + 'components:dirs': [], + // 'storybook:config': { stories: [] } + } + return fn(arg[hook]) + }), +} + +test('Nuxt module', async () => { + nuxtMock.options = { + druxt: {} + } + await DruxtBlocksNuxtModule.setup({}, nuxtMock) +}) diff --git a/packages/blocks/test/nuxtStorybook.test.js b/packages/blocks/test/nuxt/storybook.test.js similarity index 65% rename from packages/blocks/test/nuxtStorybook.test.js rename to packages/blocks/test/nuxt/storybook.test.js index 593638cca..37ec0e57e 100644 --- a/packages/blocks/test/nuxtStorybook.test.js +++ b/packages/blocks/test/nuxt/storybook.test.js @@ -1,7 +1,12 @@ -import DruxtBlocksStorybook from '../src/nuxtStorybook' +import DruxtBlocksStorybook from '../../src/nuxt/storybook' jest.mock('axios') +jest.mock('@nuxt/kit', () => ({ + addTemplate: jest.fn(), + defineNuxtModule: (module) => module, +})) + const mock = { addTemplate: jest.fn(), options: { diff --git a/packages/blocks/test/nuxtModule.test.js b/packages/blocks/test/nuxtModule.test.js deleted file mode 100644 index 47e04540a..000000000 --- a/packages/blocks/test/nuxtModule.test.js +++ /dev/null @@ -1,24 +0,0 @@ -import { DruxtBlocksNuxtModule } from '../src/nuxtModule' - -jest.mock('../src/nuxtStorybook') - -const mock = { - addModule: jest.fn(), - nuxt: { - hook: jest.fn((hook, fn) => { - const arg = { - 'components:dirs': [], - 'storybook:config': { stories: [] } - } - return fn(arg[hook]) - }), - }, - DruxtBlocksNuxtModule -} - -test('Nuxt module', () => { - mock.options = { - druxt: {} - } - mock.DruxtBlocksNuxtModule() -})