Skip to content

Weather app labs mishandle missing data and zero measurements #71479

Closed

Description

@majestic-owl448

Describe the Issue

The following files have two problems in their supplied solutions and tests:

  • curriculum/challenges/english/blocks/lab-weather-app/66f12a88741aeb16b9246c59.md
  • curriculum/challenges/english/blocks/lab-weather-app-v2/66f12a88741aeb16b9246c59.md
  1. Missing weather data causes an asynchronous rejection that the test does not check. The missing-data test uses:

    assert.doesNotThrow(showWeather);

    assert.doesNotThrow(() => showWeather(city));

    These assertions check synchronous exceptions but do not await the promise returned by showWeather. The supplied solution immediately destructures the result of await getWeather(city), even when that result is undefined.

    With the lab's Paris mock, showWeather("paris") displays the required alert, then rejects with Cannot destructure property 'weather' of 'json' as it is undefined. The missing-data test does not detect this rejection. Its temporary getWeather replacement is also restored before the asynchronous calls finish.

  2. Valid zero measurements display as missing data. The solution uses truthiness checks for temperature, feels-like temperature, humidity, wind speed, and gust speed. For example:

    tempEl.innerHTML = temp ? `${temp}° C` : 'N/A';

    The expected-value helper repeats the same mistake:

    "main-temperature": wobj.main.temp || "N/A",

    Returning 0 for all five measurements produces N/A, Feels Like: N/A, Humidity: N/A, Wind: N/A, and Gusts: N/A. The user story reserves N/A for undefined values. The existing city fixtures do not cover zero measurements, and the helper would expect N/A for them.

Affected Pages

https://www.freecodecamp.org/learn/javascript-v9/lab-weather-app/lab-weather-app

https://www.freecodecamp.org/learn/front-end-development/lab-weather-app-v2/lab-weather-app

Expected behavior

  1. Both supplied solutions should handle missing weather data without rejecting. The error case should display exactly one alert with Something went wrong, please try again later and should not update the weather display. The tests should await the asynchronous operation, fail on rejection, verify the alert and unchanged display, and restore temporary replacements after the operation finishes.

  2. Both solutions and their expected-value helpers should preserve valid zero measurements and use N/A for undefined values. The tests should include zero-valued measurements and verify that all five corresponding elements display zero with any applicable units or labels, while retaining coverage for missing values.

Activity

  1. added
    help wanted
    scope: curriculum
    js v9 cert
    on Oct 31, 2026
  2. 27-amu commented on Nov 1, 2026

    @27-amu

    I'd like to work on this issue! I'll update both lab challenge files to properly handle zero measurements (avoiding falsey checks) and ensure missing data and error states are correctly handled without unhandled promise rejections.

  3. majestic-owl448 commented on Nov 1, 2026

    @majestic-owl448
    ContributorAuthor

    @27-amu We typically do not assign issues. Instead, we accept the first pull request that comprehensively solves the issue.

    Issues labeled with help wanted or first timers only are open for contributions.

    Please make sure you read our guidelines for contributing. We prioritize contributors following the instructions in our guide. Join us in our chat room or the forum if you need help contributing - our community will be happy to assist you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedjs v9 certscope: curriculum

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions