@fedify/cfworkers tests the same classes twice. packages/cfworkers/src/mod.test.ts drives them through hand-written mocks; packages/cfworkers/test/mq.test.ts and packages/cfworkers/test/kv.test.ts drive them through the miniflare bindings that packages/cfworkers/wrangler.jsonc declares. Nothing records which file a new test belongs in, so tests keep landing in both.
All four WorkersMessageQueue tests in src/mod.test.ts are now covered by test/mq.test.ts:
enqueue() sends __fedify_ordering_key__ and __fedify_payload__ to the queue binding duplicates enqueue() with ordering key, which additionally asserts the send() options.
processMessage() - returns shouldProcess=false when lock exists duplicates returns shouldProcess=false when lock exists.
processMessage() - release() frees the ordering lock covers the same acquire-and-release cycle as acquires lock and processes message with ordering key, adding only an assertion that the next message gets through.
listen() throws TypeError duplicates the test of the same name, asserting the whole error message where the other asserts a prefix.
#1023 followed #878 as written. #878 asked for enqueueMany() coverage that test/mq.test.ts already had, so the three tests it added to src/mod.test.ts land on top of existing ones. Adding a stray field to the wrapper inside enqueueMany() fails the new tests and the existing ones together, so the new ones catch nothing the suite was missing.
The copies in src/mod.test.ts also test less of the binding contract. test/mq.test.ts spies on env.Q1, the real queue producer binding, so it asserts against the actual Queue API surface. A hand-written mock keeps passing when that surface changes.
Delete the duplicates after deciding which kind of test belongs in each file. Record that rule in a comment at the top of both files. One split that fits the current code: src/mod.test.ts keeps logic that needs no binding, and anything asserting what goes out to a queue or a KV namespace lives under test/.
Suggested check: mise run check-each cfworkers.
@fedify/cfworkerstests the same classes twice. packages/cfworkers/src/mod.test.ts drives them through hand-written mocks; packages/cfworkers/test/mq.test.ts and packages/cfworkers/test/kv.test.ts drive them through the miniflare bindings that packages/cfworkers/wrangler.jsonc declares. Nothing records which file a new test belongs in, so tests keep landing in both.All four
WorkersMessageQueuetests in src/mod.test.ts are now covered by test/mq.test.ts:enqueue() sends __fedify_ordering_key__ and __fedify_payload__ to the queue bindingduplicatesenqueue() with ordering key, which additionally asserts thesend()options.processMessage() - returns shouldProcess=false when lock existsduplicatesreturns shouldProcess=false when lock exists.processMessage() - release() frees the ordering lockcovers the same acquire-and-release cycle asacquires lock and processes message with ordering key, adding only an assertion that the next message gets through.listen() throws TypeErrorduplicates the test of the same name, asserting the whole error message where the other asserts a prefix.#1023 followed #878 as written. #878 asked for
enqueueMany()coverage that test/mq.test.ts already had, so the three tests it added to src/mod.test.ts land on top of existing ones. Adding a stray field to the wrapper insideenqueueMany()fails the new tests and the existing ones together, so the new ones catch nothing the suite was missing.The copies in src/mod.test.ts also test less of the binding contract. test/mq.test.ts spies on
env.Q1, the real queue producer binding, so it asserts against the actualQueueAPI surface. A hand-written mock keeps passing when that surface changes.Delete the duplicates after deciding which kind of test belongs in each file. Record that rule in a comment at the top of both files. One split that fits the current code: src/mod.test.ts keeps logic that needs no binding, and anything asserting what goes out to a queue or a KV namespace lives under test/.
Suggested check:
mise run check-each cfworkers.