@@ -32,7 +32,7 @@ describe('initial-parameters', () => {
3232 } ) ;
3333 jest
3434 . spyOn ( envModule , 'getEnvironmentVariables' )
35- . mockReturnValue ( { TODAY : '2022-06-22' , EDITOR : undefined } ) ;
35+ . mockReturnValue ( { EDITOR : undefined } ) ;
3636 when ( jest . spyOn ( projectModule , 'readProject' ) )
3737 . calledWith ( '/path/to/project' )
3838 . mockResolvedValue ( project ) ;
@@ -46,7 +46,6 @@ describe('initial-parameters', () => {
4646 project,
4747 tempDirectoryPath : '/path/to/temp' ,
4848 reset : true ,
49- today : new Date ( '2022-06-22' ) ,
5049 } ) ;
5150 } ) ;
5251
@@ -63,7 +62,7 @@ describe('initial-parameters', () => {
6362 } ) ;
6463 jest
6564 . spyOn ( envModule , 'getEnvironmentVariables' )
66- . mockReturnValue ( { TODAY : undefined , EDITOR : undefined } ) ;
65+ . mockReturnValue ( { EDITOR : undefined } ) ;
6766 const readProjectSpy = jest
6867 . spyOn ( projectModule , 'readProject' )
6968 . mockResolvedValue ( project ) ;
@@ -84,7 +83,7 @@ describe('initial-parameters', () => {
8483 } ) ;
8584 jest
8685 . spyOn ( envModule , 'getEnvironmentVariables' )
87- . mockReturnValue ( { TODAY : undefined , EDITOR : undefined } ) ;
86+ . mockReturnValue ( { EDITOR : undefined } ) ;
8887 when ( jest . spyOn ( projectModule , 'readProject' ) )
8988 . calledWith ( '/path/to/project' )
9089 . mockResolvedValue ( project ) ;
@@ -110,7 +109,7 @@ describe('initial-parameters', () => {
110109 } ) ;
111110 jest
112111 . spyOn ( envModule , 'getEnvironmentVariables' )
113- . mockReturnValue ( { TODAY : undefined , EDITOR : undefined } ) ;
112+ . mockReturnValue ( { EDITOR : undefined } ) ;
114113 when ( jest . spyOn ( projectModule , 'readProject' ) )
115114 . calledWith ( '/path/to/project' )
116115 . mockResolvedValue ( project ) ;
@@ -125,56 +124,52 @@ describe('initial-parameters', () => {
125124 ) ;
126125 } ) ;
127126
128- it ( 'uses the current date if the TODAY environment variable was not provided ' , async ( ) => {
127+ it ( 'returns initial parameters including reset: true, derived from a command-line argument of "--reset true" ' , async ( ) => {
129128 const project = buildMockProject ( ) ;
130- const today = new Date ( '2022-01-01' ) ;
131129 when ( jest . spyOn ( commandLineArgumentsModule , 'readCommandLineArguments' ) )
132130 . calledWith ( [ 'arg1' , 'arg2' ] )
133131 . mockResolvedValue ( {
134132 projectDirectory : '/path/to/project' ,
135- tempDirectory : undefined ,
133+ tempDirectory : '/path/to/temp' ,
136134 reset : true ,
137135 } ) ;
138136 jest
139137 . spyOn ( envModule , 'getEnvironmentVariables' )
140- . mockReturnValue ( { TODAY : undefined , EDITOR : undefined } ) ;
138+ . mockReturnValue ( { EDITOR : undefined } ) ;
141139 when ( jest . spyOn ( projectModule , 'readProject' ) )
142140 . calledWith ( '/path/to/project' )
143141 . mockResolvedValue ( project ) ;
144- jest . setSystemTime ( today ) ;
145142
146143 const config = await determineInitialParameters (
147144 [ 'arg1' , 'arg2' ] ,
148- '/path/to/cwd ' ,
145+ '/path/to/somewhere ' ,
149146 ) ;
150147
151- expect ( config . today ) . toStrictEqual ( today ) ;
148+ expect ( config . reset ) . toBe ( true ) ;
152149 } ) ;
153150
154- it ( 'uses the current date if TODAY is not a parsable date ' , async ( ) => {
151+ it ( 'returns initial parameters including reset: false, derived from a command-line argument of "--reset false" ' , async ( ) => {
155152 const project = buildMockProject ( ) ;
156- const today = new Date ( '2022-01-01' ) ;
157153 when ( jest . spyOn ( commandLineArgumentsModule , 'readCommandLineArguments' ) )
158154 . calledWith ( [ 'arg1' , 'arg2' ] )
159155 . mockResolvedValue ( {
160156 projectDirectory : '/path/to/project' ,
161- tempDirectory : undefined ,
162- reset : true ,
157+ tempDirectory : '/path/to/temp' ,
158+ reset : false ,
163159 } ) ;
164160 jest
165161 . spyOn ( envModule , 'getEnvironmentVariables' )
166- . mockReturnValue ( { TODAY : 'asdfgdasf' , EDITOR : undefined } ) ;
162+ . mockReturnValue ( { EDITOR : undefined } ) ;
167163 when ( jest . spyOn ( projectModule , 'readProject' ) )
168164 . calledWith ( '/path/to/project' )
169165 . mockResolvedValue ( project ) ;
170- jest . setSystemTime ( today ) ;
171166
172167 const config = await determineInitialParameters (
173168 [ 'arg1' , 'arg2' ] ,
174- '/path/to/cwd ' ,
169+ '/path/to/somewhere ' ,
175170 ) ;
176171
177- expect ( config . today ) . toStrictEqual ( today ) ;
172+ expect ( config . reset ) . toBe ( false ) ;
178173 } ) ;
179174 } ) ;
180175} ) ;
0 commit comments