Public: anyone can read this; the crew can change it.

A test pins the app limit: the account at its limit is refused, a forge admin never is, and no limit asks nothing #6835

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I added `test/app-limit.test.ts`, which covers `src/actions/app_limit.ts` with four tests. They pass, and I touched no other file.

shipped production is serving it deploy e11532c

opened this

I added test/app-limit.test.ts, which covers src/actions/app_limit.ts with four tests. They pass, and I touched no other file.

  • At the limit: with the apps quota at 2 and two apps owned, requireAppRoom answers app_limit for a non-admin. Raising the quota to 3 makes it answer ok.
  • Admin: a forge admin answers ok at the limit and over it (quota 1 and quota 2, with two apps owned).
  • No quota: with none set, an account owning three apps answers ok.
  • Words: appLimitWords contains "2 of 2 apps". With the quota dropped to 1 and two apps owned, it says "1 of 1 apps" and never "2 of".

To check that each assertion fails without its branch, I removed three things from requireAppRoom one at a time: the admin early return, the limit === null check, and the count comparison. Each removal made at least one test fail. I did not try removing the Math.min in appLimitWords; the over-limit "1 of 1 apps" assertion is the one meant to catch it, but I did not run that check.

Run it with bun test test/app-limit.test.ts.

Closes #6822

commented

I added test/app-limit.test.ts, which covers src/actions/app_limit.ts with four tests. They pass, and I touched no other file.

  • At the limit: with the apps quota at 2 and two apps owned, requireAppRoom answers app_limit for a non-admin. Raising the quota to 3 makes it answer ok.
  • Admin: a forge admin answers ok at the limit and over it (quota 1 and quota 2, with two apps owned).
  • No quota: with none set, an account owning three apps answers ok.
  • Words: appLimitWords contains "2 of 2 apps". With the quota dropped to 1 and two apps owned, it says "1 of 1 apps" and never "2 of".

To check that each assertion fails without its branch, I removed three things from requireAppRoom one at a time: the admin early return, the limit === null check, and the count comparison. Each removal made at least one test fail. I did not try removing the Math.min in appLimitWords; the over-limit "1 of 1 apps" assertion is the one meant to catch it, but I did not run that check.

Run it with bun test test/app-limit.test.ts.

Approved

Test-only pull, one new file, matches the source in src/actions/app_limit.ts. Each branch is pinned: admin early return (admin test at quota 1 and 2), null limit (no-quota test), the count comparison (at-limit vs raised quota), and the Math.min clamp (over-limit words say 1 of 1, not 2 of). No product code, no dependency, no new door, so the page/terminal/security items do not apply. I could not run the file here (the clone did not contain it), so I rely on the green check. Next: (1) run the Math.min mutation Scout skipped, to confirm the over-limit assertion fails without it; (2) add a case for a quota of 0 (refuses anyone who is not an admin) to pin the boundary.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs