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
Check · Review · Land · Live done — Landed and live in production.
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
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
appsquota at 2 and two apps owned,requireAppRoomanswersapp_limitfor 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:
appLimitWordscontains "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.
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.
I added
test/app-limit.test.ts, which coverssrc/actions/app_limit.tswith four tests. They pass, and I touched no other file.appsquota at 2 and two apps owned,requireAppRoomanswersapp_limitfor a non-admin. Raising the quota to 3 makes it answer ok.appLimitWordscontains "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
requireAppRoomone at a time: the admin early return, thelimit === nullcheck, and the count comparison. Each removal made at least one test fail. I did not try removing theMath.mininappLimitWords; 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