Skip to content

Add getPromiseState tests for non-promise values - #205

Merged
NullVoxPopuli merged 1 commit into
mainfrom
get-promise-state-non-promise-tests
Oct 14, 2026
Merged

NullVoxPopuli merged 1 commit into
mainfrom
get-promise-state-non-promise-tests

Conversation

@NullVoxPopuli

Copy link
Copy Markdown
Contributor

Adds tests that lock in how getPromiseState handles non-promise values today. No behavior changes.

What's covered

  • undefined, created in module state and inside a template
  • null, false, true, 0, NaN, 1, '', [], [1, 2], {}, { a: 1 }, a symbol, a bigint
    • each one returns { isLoading: false, error: null, resolved: value } right away, and resolved is the exact value passed in
    • falsy values (including [], since Glimmer's {{#if}} treats empty arrays as falsy) render none of the isLoading / error / resolved branches
  • plain objects are not cached: two calls with the same object return different state objects
  • an object with a non-function then (e.g. { then: 1 }) throws a TypeError. isThennable only checks 'then' in x, and the .then(...) call is outside the try

The last two might not be what we want long-term. They're here so any change to them is deliberate.

🤖 Generated with Claude Code

Assert current behavior for undefined, null, booleans, numbers, strings,
arrays, objects, symbols, and bigints. Also cover that plain objects are
not cached, and that an object with a non-function `then` throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
reactive Ready Ready Preview Oct 14, 2026 5:38pm UTC

@NullVoxPopuli
NullVoxPopuli merged commit 170bd55 into main Oct 14, 2026
18 checks passed
@NullVoxPopuli
NullVoxPopuli deleted the get-promise-state-non-promise-tests branch October 14, 2026 17:55

This branch was successfully deployed

1 active deployment
Preview — 5057e279 Deployed Oct 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant