@@ -235,26 +235,37 @@ func TestGetCalendar(t *testing.T) {
235235 c := DefaultClient
236236 // successful
237237 c .do = func (c * Client , req * http.Request ) (* http.Response , error ) {
238- assert .Equal (t , "2018 -01-01" , req .URL .Query ().Get ("start" ))
239- assert .Equal (t , "2018 -01-02 " , req .URL .Query ().Get ("end" ))
240- calendar := [] CalendarDay {
238+ assert .Equal (t , "2023 -01-01" , req .URL .Query ().Get ("start" ))
239+ assert .Equal (t , "2023 -01-03 " , req .URL .Query ().Get ("end" ))
240+ jsonResp := `[
241241 {
242- Date : "2018-01-01" ,
243- Open : time .Now ().Format (time .RFC3339 ),
244- Close : time .Now ().Format (time .RFC3339 ),
245- },
246- }
242+ "date": "2023-01-03",
243+ "open": "09:30",
244+ "close": "16:00",
245+ "session_open": "0400",
246+ "session_close": "2000",
247+ "settlement_date": "2023-01-05"
248+ }
249+ ]`
247250 return & http.Response {
248- Body : genBody ( calendar ) ,
251+ Body : nopCloser { strings . NewReader ( jsonResp )} ,
249252 }, nil
250253 }
251254
252255 calendar , err := c .GetCalendar (GetCalendarRequest {
253- Start : time .Date (2018 , 1 , 1 , 0 , 0 , 0 , 0 , time .UTC ),
254- End : time .Date (2018 , 1 , 2 , 0 , 0 , 0 , 0 , time .UTC ),
256+ Start : time .Date (2023 , 1 , 1 , 0 , 0 , 0 , 0 , time .UTC ),
257+ End : time .Date (2023 , 1 , 3 , 0 , 0 , 0 , 0 , time .UTC ),
255258 })
256259 require .NoError (t , err )
257260 assert .Len (t , calendar , 1 )
261+ assert .Equal (t , CalendarDay {
262+ Date : "2023-01-03" ,
263+ Open : "09:30" ,
264+ Close : "16:00" ,
265+ SessionOpen : "0400" ,
266+ SessionClose : "2000" ,
267+ SettlementDate : "2023-01-05" ,
268+ }, calendar [0 ])
258269
259270 // api failure
260271 c .do = func (c * Client , req * http.Request ) (* http.Response , error ) {
0 commit comments