@@ -4,50 +4,49 @@ const helpers = require('yeoman-test');
4
4
const assert = require ( 'yeoman-assert' ) ;
5
5
6
6
describe ( 'Systemic basic services with no extra components' , ( ) => {
7
+ const generateService = ( components , next ) => {
8
+ helpers . run ( path . join ( __dirname , '../generators/app' ) )
9
+ . withPrompts ( {
10
+ name : 'test-service' ,
11
+ description : 'some description' ,
12
+ components,
13
+ } )
14
+ . on ( 'error' , next )
15
+ . on ( 'end' , next ) ;
16
+ } ;
7
17
8
- const generateService = ( components , next ) => {
9
- helpers . run ( path . join ( __dirname , '../generators/app' ) )
10
- . withPrompts ( {
11
- name : 'test-service' ,
12
- description : 'some description' ,
13
- components : components
14
- } )
15
- . on ( 'error' , next )
16
- . on ( 'end' , next ) ;
17
- } ;
18
+ it ( 'should create a service with proper configuration' , done => {
19
+ const targetComponents = [ ] ;
20
+ generateService ( targetComponents , ( ) => {
21
+ assert . file ( [ 'config/default.js' , 'config/local.js' , 'config/prod.js' , 'config/test.js' , 'config/build.js' ] ) ;
22
+ assert . fileContent ( 'config/default.js' , / s e r v i c e / ) ;
23
+ assert . fileContent ( 'config/default.js' , / t r a n s p o r t : ' c o n s o l e ' / ) ;
24
+ assert . fileContent ( 'config/default.js' , / s w a g g e r O p t i o n s / ) ;
25
+ assert . fileContent ( 'config/default.js' , / s w a g g e r D e f i n i t i o n / ) ;
26
+ assert . fileContent ( 'config/local.js' , / t r a n s p o r t : ' c o n s o l e ' / ) ;
27
+ assert . noFileContent ( 'config/prod.js' , / l o g g e r / ) ;
28
+ assert . fileContent ( 'config/test.js' , / t r a n s p o r t : n u l l / ) ;
29
+ assert . fileContent ( 'config/build.js' , / t r a n s p o r t : n u l l / ) ;
30
+ done ( ) ;
31
+ } ) ;
32
+ } ) ;
18
33
19
- it ( 'should create a service with proper configuration' , ( done ) => {
20
- const targetComponents = [ ] ;
21
- generateService ( targetComponents , ( ) => {
22
- assert . file ( [ 'config/default.js' , 'config/local.js' , 'config/prod.js' , 'config/test.js' , 'config/build.js' ] ) ;
23
- assert . fileContent ( 'config/default.js' , / s e r v i c e / ) ;
24
- assert . fileContent ( 'config/default.js' , / t r a n s p o r t : \' c o n s o l e \' / ) ;
25
- assert . fileContent ( 'config/default.js' , / s w a g g e r O p t i o n s / ) ;
26
- assert . fileContent ( 'config/default.js' , / s w a g g e r D e f i n i t i o n / ) ;
27
- assert . fileContent ( 'config/local.js' , / t r a n s p o r t : \' c o n s o l e \' / ) ;
28
- assert . noFileContent ( 'config/prod.js' , / l o g g e r / ) ;
29
- assert . fileContent ( 'config/test.js' , / t r a n s p o r t : n u l l / ) ;
30
- assert . fileContent ( 'config/build.js' , / t r a n s p o r t : n u l l / ) ;
31
- done ( ) ;
32
- } ) ;
33
- } ) ;
34
+ it ( 'should create a service with proper components folder' , done => {
35
+ const targetComponents = [ ] ;
36
+ generateService ( targetComponents , ( ) => {
37
+ assert . file ( [ 'components/app/index.js' ] ) ;
38
+ assert . file ( [ 'components/config/confabulous.js' , 'components/config/index.js' ] ) ;
39
+ assert . file ( [ 'components/config/confabulous.js' , 'components/config/index.js' ] ) ;
40
+ assert . file ( [ 'components/logging/bunyan.js' , 'components/logging/console.js' , 'components/logging/index.js' , 'components/logging/prepper.js' ] ) ;
41
+ done ( ) ;
42
+ } ) ;
43
+ } ) ;
34
44
35
- it ( 'should create a service with proper components folder' , ( done ) => {
36
- const targetComponents = [ ] ;
37
- generateService ( targetComponents , ( ) => {
38
- assert . file ( [ 'components/app/index.js' ] ) ;
39
- assert . file ( [ 'components/config/confabulous.js' , 'components/config/index.js' ] ) ;
40
- assert . file ( [ 'components/config/confabulous.js' , 'components/config/index.js' ] ) ;
41
- assert . file ( [ 'components/logging/bunyan.js' , 'components/logging/console.js' , 'components/logging/index.js' , 'components/logging/prepper.js' ] ) ;
42
- done ( ) ;
43
- } ) ;
44
- } ) ;
45
-
46
- it ( 'should create a service with basic files' , ( done ) => {
47
- const targetComponents = [ ] ;
48
- generateService ( targetComponents , ( ) => {
49
- assert . file ( [ '.dockerignore' , '.eslintrc.json' , '.gitignore' , '.nvmrc' , 'Dockerfile' , 'index.js' , 'package.json' , 'README.md' , 'system.js' ] ) ;
50
- done ( ) ;
51
- } ) ;
52
- } ) ;
45
+ it ( 'should create a service with basic files' , done => {
46
+ const targetComponents = [ ] ;
47
+ generateService ( targetComponents , ( ) => {
48
+ assert . file ( [ '.dockerignore' , '.eslintrc.json' , '.gitignore' , '.nvmrc' , 'Dockerfile' , 'index.js' , 'package.json' , 'README.md' , 'system.js' ] ) ;
49
+ done ( ) ;
50
+ } ) ;
51
+ } ) ;
53
52
} ) ;
0 commit comments