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

/next has a test that finds its rows in the dispatcher's order #11737

Merged opened this

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

Merged

I added `test/next-order-page.test.ts`, which checks that `/next` lists its numbered rows in the same order the queue API returns. It passes, and `bun x tsc --noEmit`, `bun scripts/design-lint.ts` and `bun scripts/gate.ts` are clean. No source files changed.

shipped production is serving it deploy 4e6f862

opened this

I added test/next-order-page.test.ts, which checks that /next lists its numbered rows in the same order the queue API returns. It passes, and bun x tsc --noEmit, bun scripts/design-lint.ts and bun scripts/gate.ts are clean. No source files changed.

What the test does

  • It seeds a repository with a Later gate and 13 open issues, then moves two to the top and two behind Later.
  • It fetches /alice/order/next and /api/v1/repos/alice/order/queue through the running server, so it checks the real route rather than calling nextPage directly.
  • It checks the three folds against that order:

- "Up next" has a count of 10 and holds the API's first 10 numbers. - "After" has a count of 1 and holds the rest. - "Later" has a count of 2 and holds the numbers nextUp() returns for the parked rows, because the queue API doesn't include those.

  • The expected order comes from the API's queue, and the Later rows from nextUp(), the function the API uses, not from a copy in the test.

Swap check

  • By hand, I swapped the first two rows in the open fold in src/web/pages/next.ts, and the test failed. I then restored the file.
  • My first mutation, reversing the first slice, didn't change the output because rows are rendered by index. That was a bad mutation, not a test gap.

Left out

  • scripts/gate.ts needed no edit. It gates every test/*.test.ts automatically.
  • I took no before/after screenshots of /next at 390 px and 1280 px. The page is unchanged, and this sandbox can't capture screenshots.
  • I only ran the new test file, not the full suite. The forge runs the full check on push.

Try it: bun test test/next-order-page.test.ts

Closes #11734

commented

I added test/next-order-page.test.ts, which checks that /next lists its numbered rows in the same order the queue API returns. It passes, and bun x tsc --noEmit, bun scripts/design-lint.ts and bun scripts/gate.ts are clean. No source files changed.

What the test does

  • It seeds a repository with a Later gate and 13 open issues, then moves two to the top and two behind Later.
  • It fetches /alice/order/next and /api/v1/repos/alice/order/queue through the running server, so it checks the real route rather than calling nextPage directly.
  • It checks the three folds against that order:

- "Up next" has a count of 10 and holds the API's first 10 numbers. - "After" has a count of 1 and holds the rest. - "Later" has a count of 2 and holds the numbers nextUp() returns for the parked rows, because the queue API doesn't include those.

  • The expected order comes from the API's queue, and the Later rows from nextUp(), the function the API uses, not from a copy in the test.

Swap check

  • By hand, I swapped the first two rows in the open fold in src/web/pages/next.ts, and the test failed. I then restored the file.
  • My first mutation, reversing the first slice, didn't change the output because rows are rendered by index. That was a bad mutation, not a test gap.

Left out

  • scripts/gate.ts needed no edit. It gates every test/*.test.ts automatically.
  • I took no before/after screenshots of /next at 390 px and 1280 px. The page is unchanged, and this sandbox can't capture screenshots.
  • I only ran the new test file, not the full suite. The forge runs the full check on push.

Try it: bun test test/next-order-page.test.ts

Approved

The test drives the real /next route and the queue API, asserts order and each fold count (Up next, After, Later), and Later comes from nextUp rather than a copy. Swap check was done by hand and reported. gate.ts needs no edit. Two things I would do next: (1) rename made2/made3 to something that says what they hold (e.g. made, numbers) and explain or drop the unused "Later gate" issue; (2) add the before/after /next screenshots at 390 and 1280 px that the issue asked for, or state in the pull that no source changed so none apply.

commented

Left #11734 open: 1 unticked item remain (bun test on the new file, bun scripts/design-lint.ts and bun x tsc --noEmit pass. Before/after screenshots of /next at 390 px and 1280 px from the preview go in the pull. There should be no visual change.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs