Skip to content

Digital Pet Game lab: PetMood enum and Record tests reject valid TypeScript #71494

Open
notsoravii/freeCodeCamp
#3

Description

@jerome-queck

Affected page

Build a Digital Pet Game (lab-digital-pet-game, curriculum/challenges/english/blocks/lab-digital-pet-game/68c362b379059c388d3874f2.md)

Describe the issue

The tests that check the PetMood members use regexes like /\s*enum\s+PetMood\s*{[\s*\w+,\s*]*HAPPY[\s*\w+,\s*]*}/. The [...] parts are character classes, so only word characters, whitespace, *, + and , are allowed around each member. Valid enums fail all seven member tests, for example:

enum PetMood { HAPPY = "happy", SAD = "sad", /* ... */ }

or any enum with a comment inside it.

The user stories also list the moods as Happy, Excited, Content, Sad, Tired, Sick, Hungry, but the tests require HAPPY, EXCITED, ... and [PetMood.HAPPY], so a learner following the stories fails every mood test.

The Record<PetMood, string> test (/\s*(?:const|let|var)\s+\w+:\s+Record<PetMood,\s*string>/) requires a space after the colon, so const moods:Record<PetMood, string> fails.

Minor: the hint text reads "Record<PetMood, string" (missing >), and the SAD hint has a stray quote ("SAD'.").

Expected behavior

The tests accept valid enum declarations (initialisers, comments, spacing) and a valid Record annotation, and the user stories use the same member names the tests check.

I'd like to open a PR to fix this.

Activity

  1. added
    status: waiting triage
    on Oct 31, 2026
  2. MuhammadAhmad67889 commented on Nov 5, 2026

    @MuhammadAhmad67889
    Contributor

    I'd like to work on this. My plan: fix the PetMood member-test regexes so valid enums pass (initialisers like HAPPY = "happy", comments inside the enum, and varied spacing), fix the Record<PetMood, string> test so it accepts a missing space after the colon, align the user stories with the member names the tests check, and fix the two hint typos (the missing > in the Record hint and the stray quote in the SAD hint). Please assign the issue to me if that works.

  3. jerome-queck commented on Nov 5, 2026

    @jerome-queck
    ContributorAuthor

    @MuhammadAhmad67889 hey — there’s already an open PR that covers the fixes you outlined: #71496 (PetMood enum member regexes, Record spacing, user-story names, and the two hint typos).

    Happy to work together on it if you’d like — feel free to review, suggest changes, or take a co-author commit on that PR. No need for a separate one covering the same ground.

  4. added
    frontend libraries v9 cert
    on Nov 13, 2026
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

    frontend libraries v9 certstatus: waiting triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions