Skip to content

Commit

Permalink
chore(#693): update druxt-site tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Decipher committed Aug 13, 2024
1 parent b19782f commit 1ffe6d7
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 39 deletions.
File renamed without changes.
39 changes: 39 additions & 0 deletions packages/site/test/nuxt/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import DruxtSiteNuxtModule from '../../src/nuxt'

jest.mock('../../src/nuxt/storybook')

jest.mock('@nuxt/kit', () => ({
addLayout: jest.fn(),
defineNuxtModule: (module) => module,
installModule: jest.fn(),
}))

import { installModule } from '@nuxt/kit'

const nuxtMock = {
hook: jest.fn((hook, fn) => {
const arg = {
'components:dirs': [],
'storybook:config': { stories: [] }
}
return fn(arg[hook])
}),
}

jest.mock('druxt-schema')

describe('DruxtJS Site module', () => {
test('Nuxt module', async () => {
nuxtMock.options = {
dir: { layouts: 'layouts' },
druxt: {},
srcDir: __dirname,
}

// Call DruxtSite module.
await await DruxtSiteNuxtModule.setup({}, nuxtMock)

// Expect 9 modules to be added.
expect(installModule).toHaveBeenCalledTimes(8)
})
})
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { resolve } from 'path'
import DruxtEntityStorybook from '../src/nuxtStorybook'
import DruxtEntityStorybook from '../../src/nuxt/storybook'

jest.mock('axios')

Expand Down
38 changes: 0 additions & 38 deletions packages/site/test/nuxtModule.test.js

This file was deleted.

0 comments on commit 1ffe6d7

Please sign in to comment.