Skip to content

Commit d84fe6f

Browse files
test: fix failing test suites
1 parent 45940f9 commit d84fe6f

File tree

5 files changed

+30
-10
lines changed

5 files changed

+30
-10
lines changed

Diff for: __e2e__/commands/add.test.js

+26-7
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ describe('mevn add', () => {
3131
[
3232
`${DOWN}${DOWN}${DOWN}${ENTER}`, // Choose Nuxt.js
3333
`${SPACE}${ENTER}`, // Opt for @nuxtjs/axios module
34-
`${DOWN}${ENTER}`, // Choose spa as the rendering mode
35-
`${DOWN}${ENTER}`, // Choose static as the deploy target
34+
ENTER, // Choose universal as the rendering mode
35+
ENTER, // Choose server as the deploy target
3636
`Y${ENTER}`, // Requires server directory
3737
],
3838
tempDirPath,
@@ -41,33 +41,52 @@ describe('mevn add', () => {
4141
// Invoke the add command
4242
await runPromptWithAnswers(
4343
['add'],
44-
[ENTER, `${DOWN}${SPACE}${DOWN}${DOWN}${SPACE}${ENTER}`], // Choose @nuxtjs/pwa module and the vuex addon
44+
[
45+
ENTER,
46+
`${DOWN}${SPACE}${DOWN}${DOWN}${DOWN}${SPACE}${DOWN}${DOWN}${DOWN}${DOWN}${SPACE}${ENTER}`,
47+
], // Choose @nuxtjs/pwa, nuxt-oauth and @nuxtjs/storybook modules
4548
genPath,
4649
);
4750

4851
// nuxt.config.js
4952
const nuxtConfig = require(path.join(clientPath, 'nuxt.config.js')).default;
5053
expect(nuxtConfig.buildModules).toContain('@nuxtjs/pwa');
54+
expect(nuxtConfig.modules).toContain('nuxt-oauth');
55+
expect(nuxtConfig.buildModules).not.toContain('@nuxtjs/storybook');
5156
expect(nuxtConfig.modules).toContain('@nuxtjs/axios');
5257

5358
// .mevnrc
5459
const projectConfig = JSON.parse(
5560
fs.readFileSync(path.join(genPath, '.mevnrc')),
5661
);
57-
expect(projectConfig.modules).toContain('pwa');
58-
expect(projectConfig.modules).toContain('vuex');
59-
expect(projectConfig.modules).toContain('axios');
62+
['pwa', 'oauth', 'storybook', 'vuex', 'axios'].forEach((module) =>
63+
expect(projectConfig.modules).toContain(module),
64+
);
65+
expect(projectConfig.isConfigured).toBe(true);
6066

6167
// package.json
6268
const pkgJson = JSON.parse(
6369
fs.readFileSync(path.join(clientPath, 'package.json')),
6470
);
71+
expect(pkgJson.dependencies['nuxt-oauth']).toBeTruthy();
6572
expect(pkgJson.devDependencies['@nuxtjs/pwa']).toBeTruthy();
73+
expect(pkgJson.devDependencies['@nuxtjs/storybook']).toBeTruthy();
6674

6775
// @nuxtjs/axios should be installed via mevn serve since it was opted at first
6876
expect(pkgJson.devDependencies['@nuxtjs/axios']).not.toBeTruthy();
6977

70-
// vuex-store
78+
const gitIgnoreContent = fs
79+
.readFileSync(path.join(clientPath, '.gitignore'), 'utf8')
80+
.split('\n');
81+
expect(gitIgnoreContent.includes('.nuxt-storybook')).toBeTruthy();
82+
expect(gitIgnoreContent.includes('storybook-static')).toBeTruthy();
83+
84+
const nuxtIgnoreContent = fs
85+
.readFileSync(path.join(clientPath, '.nuxtignore'), 'utf8')
86+
.split('\n');
87+
expect(nuxtIgnoreContent.includes('**/*.stories.js')).toBeTruthy();
88+
89+
// vuex-store is activated via nuxt-oauth
7190
expect(
7291
fs.readFileSync(path.join(clientPath, 'store', 'index.js')),
7392
).toBeTruthy();

Diff for: __e2e__/commands/init.test.js

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ describe('mevn init', () => {
6464
// .mevnrc
6565
const projectConfigContent = {
6666
name: 'my-app',
67+
renderingMode: 'spa',
6768
template: 'Nuxt.js',
6869
modules: ['pwa', 'content'],
6970
deployTarget: 'static',

Diff for: jest/helpers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const runPromptWithAnswers = (args, answers, testPath) => {
2323
setTimeout(() => {
2424
process.stdin.write(answers[0]);
2525
writeToStdin(answers.slice(1));
26-
}, 2000);
26+
}, 3000);
2727
} else {
2828
process.stdin.end();
2929
}

Diff for: jest/setupE2eTests.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
jest.setTimeout(60000);
1+
jest.setTimeout(240000);

Diff for: src/commands/basic/add.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ const addDeps = async (deps, { dev }) => {
477477
// Update modules entry with the installed Nuxt.js modules
478478
const installedNuxtModules = [].concat(modules, buildModules, addons);
479479
if (
480-
installedNuxtModules.includes('nuxt-oauth') &&
480+
installedNuxtModules.includes('oauth') &&
481481
!installedNuxtModules.includes('vuex')
482482
) {
483483
// Vuex Store is activated with nuxt-oauth

0 commit comments

Comments
 (0)