Skip to content

Count watches, not attaches, in the requestInit no-re-watch test - #1611

Open
dormouse-bot wants to merge 1 commit into
mainfrom
nightly/remote-adapter-rewatch-test
Open

dormouse-bot wants to merge 1 commit into
mainfrom
nightly/remote-adapter-rewatch-test

Conversation

@dormouse-bot

Copy link
Copy Markdown
Collaborator

The RemotePtyAdapter test titled "requestInit re-emits the cached list without re-watching" never checked for re-watching. Its only guard was expect(client.attaches).toHaveLength(0), and FakeClient.watchDirectory records nothing, so the test stayed green even if requestInit subscribed to the Burrow directory again. Only the #watchPromise memo in #ensureDirectoryWatch prevents that re-subscribe. The test now spies on watchDirectory and expects exactly one call.

To verify, I replaced the memo check with if (true) and the test failed (toHaveBeenCalledTimes(1)). With the code restored, all 28 tests in the file pass. This PR changes no production code.

The test named 'requestInit re-emits the cached list without re-watching'
asserted only that nothing attached, so a broken #watchPromise memo that
re-subscribed on every requestInit still passed. It now spies on
watchDirectory and expects exactly one call.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 12bc9a4
Status: ✅  Deploy successful!
Preview URL: https://db62f5e5.mouseterm.pages.dev
Branch Preview URL: https://nightly-remote-adapter-rewat.mouseterm.pages.dev

View logs

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant