@@ -31,8 +31,8 @@ describe('mevn add', () => {
31
31
[
32
32
`${ DOWN } ${ DOWN } ${ DOWN } ${ ENTER } ` , // Choose Nuxt.js
33
33
`${ 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
36
36
`Y${ ENTER } ` , // Requires server directory
37
37
] ,
38
38
tempDirPath ,
@@ -41,33 +41,52 @@ describe('mevn add', () => {
41
41
// Invoke the add command
42
42
await runPromptWithAnswers (
43
43
[ '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
45
48
genPath ,
46
49
) ;
47
50
48
51
// nuxt.config.js
49
52
const nuxtConfig = require ( path . join ( clientPath , 'nuxt.config.js' ) ) . default ;
50
53
expect ( nuxtConfig . buildModules ) . toContain ( '@nuxtjs/pwa' ) ;
54
+ expect ( nuxtConfig . modules ) . toContain ( 'nuxt-oauth' ) ;
55
+ expect ( nuxtConfig . buildModules ) . not . toContain ( '@nuxtjs/storybook' ) ;
51
56
expect ( nuxtConfig . modules ) . toContain ( '@nuxtjs/axios' ) ;
52
57
53
58
// .mevnrc
54
59
const projectConfig = JSON . parse (
55
60
fs . readFileSync ( path . join ( genPath , '.mevnrc' ) ) ,
56
61
) ;
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 ) ;
60
66
61
67
// package.json
62
68
const pkgJson = JSON . parse (
63
69
fs . readFileSync ( path . join ( clientPath , 'package.json' ) ) ,
64
70
) ;
71
+ expect ( pkgJson . dependencies [ 'nuxt-oauth' ] ) . toBeTruthy ( ) ;
65
72
expect ( pkgJson . devDependencies [ '@nuxtjs/pwa' ] ) . toBeTruthy ( ) ;
73
+ expect ( pkgJson . devDependencies [ '@nuxtjs/storybook' ] ) . toBeTruthy ( ) ;
66
74
67
75
// @nuxtjs /axios should be installed via mevn serve since it was opted at first
68
76
expect ( pkgJson . devDependencies [ '@nuxtjs/axios' ] ) . not . toBeTruthy ( ) ;
69
77
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
71
90
expect (
72
91
fs . readFileSync ( path . join ( clientPath , 'store' , 'index.js' ) ) ,
73
92
) . toBeTruthy ( ) ;
0 commit comments