@@ -28,7 +28,10 @@ describe('apify init', () => {
2828 } ) ;
2929
3030 it ( 'correctly creates basic structure with empty INPUT.json' , async ( ) => {
31- await testRunCommand ( InitCommand , { args_actorName : actName , flags_yes : true } ) ;
31+ await testRunCommand ( InitCommand , {
32+ args_actorName : actName ,
33+ flags_yes : true ,
34+ } ) ;
3235
3336 // Check that it won't create deprecated config
3437 // TODO: We can remove this later
@@ -62,11 +65,17 @@ describe('apify init', () => {
6265 required : [ 'url' ] ,
6366 } ;
6467
65- const defaultActorJson = Object . assign ( EMPTY_LOCAL_CONFIG , { name : actName , input } ) ;
68+ const defaultActorJson = Object . assign ( EMPTY_LOCAL_CONFIG , {
69+ name : actName ,
70+ input,
71+ } ) ;
6672
6773 await mkdir ( joinPath ( '.actor' ) , { recursive : true } ) ;
6874 writeFileSync ( joinPath ( LOCAL_CONFIG_PATH ) , JSON . stringify ( defaultActorJson , null , '\t' ) , { flag : 'w' } ) ;
69- await testRunCommand ( InitCommand , { args_actorName : actName , flags_yes : true } ) ;
75+ await testRunCommand ( InitCommand , {
76+ args_actorName : actName ,
77+ flags_yes : true ,
78+ } ) ;
7079
7180 // Check that it won't create deprecated config
7281 // TODO: We can remove this later
@@ -79,4 +88,31 @@ describe('apify init', () => {
7988 ) ,
8089 ) . toStrictEqual ( { url : 'https://www.apify.com/' } ) ;
8190 } ) ;
91+
92+ it ( 'correctly creates config with dockerfile when provided' , async ( ) => {
93+ const dockerfilePath = './Dockerfile' ;
94+ await testRunCommand ( InitCommand , {
95+ args_actorName : actName ,
96+ flags_yes : true ,
97+ flags_dockerfile : dockerfilePath ,
98+ } ) ;
99+
100+ const config = JSON . parse ( readFileSync ( joinPath ( LOCAL_CONFIG_PATH ) , 'utf8' ) ) ;
101+ expect ( config ) . toMatchObject ( {
102+ ...EMPTY_LOCAL_CONFIG ,
103+ name : actName ,
104+ dockerfile : dockerfilePath ,
105+ } ) ;
106+ } ) ;
107+
108+ it ( 'correctly creates config without dockerfile when not provided' , async ( ) => {
109+ await testRunCommand ( InitCommand , {
110+ args_actorName : actName ,
111+ flags_yes : true ,
112+ } ) ;
113+
114+ const config = JSON . parse ( readFileSync ( joinPath ( LOCAL_CONFIG_PATH ) , 'utf8' ) ) ;
115+ expect ( config ) . toStrictEqual ( Object . assign ( EMPTY_LOCAL_CONFIG , { name : actName } ) ) ;
116+ expect ( config . dockerfile ) . toBeUndefined ( ) ;
117+ } ) ;
82118} ) ;
0 commit comments