File tree Expand file tree Collapse file tree
tests/unit/modules/default/weather/providers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -241,6 +241,36 @@ describe("WeatherGovProvider", () => {
241241 expect ( day ) . toHaveProperty ( "weatherType" ) ;
242242 expect ( day ) . toHaveProperty ( "precipitationProbability" ) ;
243243 } ) ;
244+
245+ it ( "should not skip the first day of forecast data" , async ( ) => {
246+ const provider = new WeatherGovProvider ( {
247+ lat : 40.71 ,
248+ lon : - 74.0 ,
249+ type : "forecast"
250+ } ) ;
251+
252+ const dataPromise = new Promise ( ( resolve ) => {
253+ provider . setCallbacks ( resolve , vi . fn ( ) ) ;
254+ } ) ;
255+
256+ server . use (
257+ http . get ( WEATHERGOV_FORECAST_URL , ( ) => {
258+ return HttpResponse . json ( forecastData ) ;
259+ } )
260+ ) ;
261+
262+ await provider . initialize ( ) ;
263+ provider . start ( ) ;
264+
265+ const result = await dataPromise ;
266+
267+ // Mock data starts on 2026-02-06 ("This Afternoon").
268+ // Before the fix, slice(1) dropped today, so result[0] would have been 2026-02-07.
269+ const firstDate = result [ 0 ] . date ;
270+ expect ( firstDate . getFullYear ( ) ) . toBe ( 2026 ) ;
271+ expect ( firstDate . getMonth ( ) ) . toBe ( 1 ) ; // February (0-indexed)
272+ expect ( firstDate . getDate ( ) ) . toBe ( 6 ) ;
273+ } ) ;
244274 } ) ;
245275
246276 describe ( "Hourly Parsing" , ( ) => {
You can’t perform that action at this time.
0 commit comments