@@ -32,7 +32,7 @@ describe('initial-parameters', () => {
32
32
} ) ;
33
33
jest
34
34
. spyOn ( envModule , 'getEnvironmentVariables' )
35
- . mockReturnValue ( { TODAY : '2022-06-22' , EDITOR : undefined } ) ;
35
+ . mockReturnValue ( { EDITOR : undefined } ) ;
36
36
when ( jest . spyOn ( projectModule , 'readProject' ) )
37
37
. calledWith ( '/path/to/project' )
38
38
. mockResolvedValue ( project ) ;
@@ -46,7 +46,6 @@ describe('initial-parameters', () => {
46
46
project,
47
47
tempDirectoryPath : '/path/to/temp' ,
48
48
reset : true ,
49
- today : new Date ( '2022-06-22' ) ,
50
49
} ) ;
51
50
} ) ;
52
51
@@ -63,7 +62,7 @@ describe('initial-parameters', () => {
63
62
} ) ;
64
63
jest
65
64
. spyOn ( envModule , 'getEnvironmentVariables' )
66
- . mockReturnValue ( { TODAY : undefined , EDITOR : undefined } ) ;
65
+ . mockReturnValue ( { EDITOR : undefined } ) ;
67
66
const readProjectSpy = jest
68
67
. spyOn ( projectModule , 'readProject' )
69
68
. mockResolvedValue ( project ) ;
@@ -84,7 +83,7 @@ describe('initial-parameters', () => {
84
83
} ) ;
85
84
jest
86
85
. spyOn ( envModule , 'getEnvironmentVariables' )
87
- . mockReturnValue ( { TODAY : undefined , EDITOR : undefined } ) ;
86
+ . mockReturnValue ( { EDITOR : undefined } ) ;
88
87
when ( jest . spyOn ( projectModule , 'readProject' ) )
89
88
. calledWith ( '/path/to/project' )
90
89
. mockResolvedValue ( project ) ;
@@ -110,7 +109,7 @@ describe('initial-parameters', () => {
110
109
} ) ;
111
110
jest
112
111
. spyOn ( envModule , 'getEnvironmentVariables' )
113
- . mockReturnValue ( { TODAY : undefined , EDITOR : undefined } ) ;
112
+ . mockReturnValue ( { EDITOR : undefined } ) ;
114
113
when ( jest . spyOn ( projectModule , 'readProject' ) )
115
114
. calledWith ( '/path/to/project' )
116
115
. mockResolvedValue ( project ) ;
@@ -125,56 +124,52 @@ describe('initial-parameters', () => {
125
124
) ;
126
125
} ) ;
127
126
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 ( ) => {
129
128
const project = buildMockProject ( ) ;
130
- const today = new Date ( '2022-01-01' ) ;
131
129
when ( jest . spyOn ( commandLineArgumentsModule , 'readCommandLineArguments' ) )
132
130
. calledWith ( [ 'arg1' , 'arg2' ] )
133
131
. mockResolvedValue ( {
134
132
projectDirectory : '/path/to/project' ,
135
- tempDirectory : undefined ,
133
+ tempDirectory : '/path/to/temp' ,
136
134
reset : true ,
137
135
} ) ;
138
136
jest
139
137
. spyOn ( envModule , 'getEnvironmentVariables' )
140
- . mockReturnValue ( { TODAY : undefined , EDITOR : undefined } ) ;
138
+ . mockReturnValue ( { EDITOR : undefined } ) ;
141
139
when ( jest . spyOn ( projectModule , 'readProject' ) )
142
140
. calledWith ( '/path/to/project' )
143
141
. mockResolvedValue ( project ) ;
144
- jest . setSystemTime ( today ) ;
145
142
146
143
const config = await determineInitialParameters (
147
144
[ 'arg1' , 'arg2' ] ,
148
- '/path/to/cwd ' ,
145
+ '/path/to/somewhere ' ,
149
146
) ;
150
147
151
- expect ( config . today ) . toStrictEqual ( today ) ;
148
+ expect ( config . reset ) . toBe ( true ) ;
152
149
} ) ;
153
150
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 ( ) => {
155
152
const project = buildMockProject ( ) ;
156
- const today = new Date ( '2022-01-01' ) ;
157
153
when ( jest . spyOn ( commandLineArgumentsModule , 'readCommandLineArguments' ) )
158
154
. calledWith ( [ 'arg1' , 'arg2' ] )
159
155
. mockResolvedValue ( {
160
156
projectDirectory : '/path/to/project' ,
161
- tempDirectory : undefined ,
162
- reset : true ,
157
+ tempDirectory : '/path/to/temp' ,
158
+ reset : false ,
163
159
} ) ;
164
160
jest
165
161
. spyOn ( envModule , 'getEnvironmentVariables' )
166
- . mockReturnValue ( { TODAY : 'asdfgdasf' , EDITOR : undefined } ) ;
162
+ . mockReturnValue ( { EDITOR : undefined } ) ;
167
163
when ( jest . spyOn ( projectModule , 'readProject' ) )
168
164
. calledWith ( '/path/to/project' )
169
165
. mockResolvedValue ( project ) ;
170
- jest . setSystemTime ( today ) ;
171
166
172
167
const config = await determineInitialParameters (
173
168
[ 'arg1' , 'arg2' ] ,
174
- '/path/to/cwd ' ,
169
+ '/path/to/somewhere ' ,
175
170
) ;
176
171
177
- expect ( config . today ) . toStrictEqual ( today ) ;
172
+ expect ( config . reset ) . toBe ( false ) ;
178
173
} ) ;
179
174
} ) ;
180
175
} ) ;
0 commit comments