-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use
@nuxt/components
for auto-registration of helper components
- Loading branch information
Showing
5 changed files
with
72 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,52 @@ | ||
import { setupTest, createPage } from '@nuxt/test-utils' | ||
|
||
describe('module with default options', () => { | ||
setupTest({ | ||
testDir: __dirname, | ||
browser: true, | ||
fixture: '../../example', | ||
config: { | ||
sanity: { | ||
projectId: 'j1o4tmjp', | ||
}, | ||
const configs = { | ||
base: { | ||
sanity: { | ||
projectId: 'j1o4tmjp', | ||
}, | ||
}) | ||
}, | ||
autoregistration: { | ||
components: true, | ||
sanity: { | ||
projectId: 'j1o4tmjp', | ||
}, | ||
}, | ||
} | ||
|
||
Object.entries(configs).forEach(([type, config]) => | ||
describe(`module with ${type} options`, () => { | ||
setupTest({ | ||
testDir: __dirname, | ||
browser: true, | ||
fixture: '../../example', | ||
config, | ||
}) | ||
|
||
test('Sanity image builder works', async () => { | ||
const page = await createPage('/') | ||
const html = await page.innerHTML('body') | ||
expect(html).toContain( | ||
'https://cdn.sanity.io/images/j1o4tmjp/production/7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170.jpg?auto=format&w=128', | ||
) | ||
}, 50000) | ||
test('Sanity image builder works', async () => { | ||
const page = await createPage('/') | ||
const html = await page.innerHTML('body') | ||
expect(html).toContain( | ||
'https://cdn.sanity.io/images/j1o4tmjp/production/7aa06723bb01a7a79055b6d6f5be80329a0e5b58-780x1170.jpg?auto=format&w=128', | ||
) | ||
}, 50000) | ||
|
||
test('Sanity config is exposed', async () => { | ||
const page = await createPage('/') | ||
const html = await page.innerHTML('body') | ||
expect(html).toContain('Project ID: j1o4tmjp') | ||
}, 50000) | ||
test('Sanity config is exposed', async () => { | ||
const page = await createPage('/') | ||
const html = await page.innerHTML('body') | ||
expect(html).toContain('Project ID: j1o4tmjp') | ||
}, 50000) | ||
|
||
test('CMS items are fetched', async () => { | ||
const page = await createPage('/') | ||
const html = await page.innerHTML('body') | ||
expect(html).toContain('Guardians of the Galaxy') | ||
}, 50000) | ||
test('CMS items are fetched', async () => { | ||
const page = await createPage('/') | ||
const html = await page.innerHTML('body') | ||
expect(html).toContain('Guardians of the Galaxy') | ||
}, 50000) | ||
|
||
test('Can view single film page', async () => { | ||
const page = await createPage('/movie/alien') | ||
const html = await page.innerHTML('body') | ||
expect(html).toContain('Arthur Dallas') | ||
}, 50000) | ||
}) | ||
test('Can view single film page', async () => { | ||
const page = await createPage('/movie/alien') | ||
const html = await page.innerHTML('body') | ||
expect(html).toContain('Arthur Dallas') | ||
}, 50000) | ||
}), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters