@@ -9,22 +9,34 @@ import {
99 testdir ,
1010} from './utils'
1111
12- describe . each ( [ 'postinstall' , [ 'build' , '--frozen' ] , [ 'prisma' , 'migrate' , 'status' ] ] ) (
13- '%s' ,
14- command => {
15- test ( 'logs an error and exits with 1 when the schemas do not exist' , async ( ) => {
16- const tmp = await testdir ( {
17- ...symlinkKeystoneDeps ,
18- 'keystone.js' : basicKeystoneConfig ,
19- } )
20- const recording = recordConsole ( )
21- await expect ( runCommand ( tmp , command ) ) . rejects . toEqual ( new ExitError ( 1 ) )
22- expect ( recording ( ) ) . toMatchInlineSnapshot (
23- `"Your Prisma and GraphQL schemas are not up to date"`
24- )
12+ describe . each ( [ 'postinstall' , [ 'build' , '--frozen' ] ] ) ( '%s' , command => {
13+ test ( 'logs an error and exits with 1 when the schemas do not exist' , async ( ) => {
14+ const tmp = await testdir ( {
15+ ...symlinkKeystoneDeps ,
16+ 'keystone.js' : basicKeystoneConfig ,
17+ } )
18+
19+ const recording = recordConsole ( )
20+ await expect ( runCommand ( tmp , command ) ) . rejects . toEqual ( new ExitError ( 1 ) )
21+
22+ expect ( recording ( ) ) . toMatchInlineSnapshot ( `"Your Prisma and GraphQL schemas are not up to date"` )
23+ } )
24+ } )
25+
26+ describe ( 'prisma migrate status' , ( ) => {
27+ test ( 'logs an error and exits with 1 when the schemas do not exist' , async ( ) => {
28+ const tmp = await testdir ( {
29+ ...symlinkKeystoneDeps ,
30+ 'keystone.js' : basicKeystoneConfig ,
2531 } )
26- }
27- )
32+ await expect ( runCommand ( tmp , [ 'build' , '--no-ui' , '--frozen' ] ) ) . rejects . toEqual ( new ExitError ( 1 ) )
33+
34+ const recording = recordConsole ( )
35+ await expect ( runCommand ( tmp , [ 'prisma' , '--frozen' , 'migrate' , 'status' ] ) ) . rejects . toEqual ( new ExitError ( 1 ) )
36+
37+ expect ( recording ( ) ) . toMatchInlineSnapshot ( `"Your Prisma and GraphQL schemas are not up to date"` )
38+ } )
39+ } )
2840
2941const schemasMatch = [ 'schema.prisma' , 'schema.graphql' ]
3042
@@ -37,9 +49,11 @@ describe('postinstall', () => {
3749 ...symlinkKeystoneDeps ,
3850 'keystone.js' : basicKeystoneConfig ,
3951 } )
52+
4053 const recording = recordConsole ( )
4154 await runCommand ( tmp , [ 'postinstall' , '--fix' ] )
4255 const files = await getFiles ( tmp , schemasMatch )
56+
4357 expect ( files ) . toEqual ( await getFiles ( `${ __dirname } /fixtures/basic-project` , schemasMatch ) )
4458 expect ( recording ( ) ) . toMatchInlineSnapshot ( `"? Generated GraphQL and Prisma schemas"` )
4559 } )
@@ -50,9 +64,11 @@ describe('postinstall', () => {
5064 ...schemas ,
5165 'keystone.js' : basicKeystoneConfig ,
5266 } )
67+
5368 const recording = recordConsole ( )
5469 await runCommand ( tmp , 'postinstall' )
5570 const files = await getFiles ( tmp , schemasMatch )
71+
5672 expect ( files ) . toEqual ( await getFiles ( `${ __dirname } /fixtures/basic-project` , schemasMatch ) )
5773 expect ( recording ( ) ) . toMatchInlineSnapshot ( `"? GraphQL and Prisma schemas are up to date"` )
5874 } )
@@ -63,8 +79,10 @@ describe('postinstall', () => {
6379 ...schemas ,
6480 'keystone.js' : basicKeystoneConfig ,
6581 } )
82+
6683 const recording = recordConsole ( )
6784 await runCommand ( tmp , 'postinstall' )
85+
6886 expect ( await getFiles ( tmp , [ 'node_modules/.keystone/**/*' ] ) ) . toMatchSnapshot ( )
6987 expect ( recording ( ) ) . toMatchInlineSnapshot ( `"? GraphQL and Prisma schemas are up to date"` )
7088 } )
0 commit comments