11const path = require ( 'path' )
22require ( 'dotenv' ) . config ( { path : path . join ( __dirname , '..' , '.env.test' ) } )
3- const { generateId, getServerlessSdk } = require ( './utils' )
4-
5- // set enough timeout for deployment to finish
6- jest . setTimeout ( 300000 )
3+ const axios = require ( 'axios' )
4+ const { generateId, getServerlessSdk } = require ( './lib/utils' )
75
86// the yaml file we're testing against
97const instanceYaml = {
108 org : 'orgDemo' ,
119 app : 'appDemo' ,
12- component : 'website' ,
10+ component : 'website@dev ' ,
1311 name : `website-integration-tests-${ generateId ( ) } ` ,
1412 stage : 'dev' ,
1513 inputs : {
16- src : path . join ( __dirname , '..' , 'example' ) ,
14+ src : path . join ( __dirname , '..' , 'example/src ' ) ,
1715 bucketName : 'my-bucket' ,
1816 region : 'ap-guangzhou'
1917 }
@@ -26,19 +24,20 @@ const credentials = {
2624 }
2725}
2826
29- // get serverless construct sdk
3027const sdk = getServerlessSdk ( instanceYaml . org )
3128
32- it ( 'should successfully deploy website app ' , async ( ) => {
29+ it ( 'should deploy success ' , async ( ) => {
3330 const instance = await sdk . deploy ( instanceYaml , credentials )
3431
3532 expect ( instance ) . toBeDefined ( )
3633 expect ( instance . instanceName ) . toEqual ( instanceYaml . name )
3734 expect ( instance . outputs . website ) . toBeDefined ( )
3835 expect ( instance . outputs . region ) . toEqual ( instanceYaml . inputs . region )
36+ const content = await axios . get ( instance . outputs . website )
37+ expect ( content . data ) . toContain ( 'Serverless Framework' ) ;
3938} )
4039
41- it ( 'should successfully remove website app ' , async ( ) => {
40+ it ( 'should remove success ' , async ( ) => {
4241 await sdk . remove ( instanceYaml , credentials )
4342 result = await sdk . getInstance ( instanceYaml . org , instanceYaml . stage , instanceYaml . app , instanceYaml . name )
4443
0 commit comments