Fetching previous weather data when the application relaunches
For the final feature in our weather application, we aim to retain the user’s selections so that upon their next visit to the application, instead of encountering an empty list, they see the cities they selected previously. This feature is likely to be highly utilized – users will only need to add a few cities initially, and afterward, they may merely open the application to have the weather for their cities loaded automatically.
So, let’s start the feature with a user acceptance test using Cypress:
const items = [ { name: "Melbourne", lat: -37.8142, lon: 144.9632, }, ]; it("fetches data when initializing when possible", () => { cy.window().then((window: any) => { window.localStorage.setItem( "favoriteItems...