test(adapters): adopt shared @chat-adapter/tests factories and matchers#674
Open
bensabic wants to merge 11 commits into
Open
test(adapters): adopt shared @chat-adapter/tests factories and matchers#674bensabic wants to merge 11 commits into
bensabic wants to merge 11 commits into
Conversation
Add `@chat-adapter/tests` as a devDependency and register its matchers via `setupFiles: ["@chat-adapter/tests/setup"]` across all 11 platform adapters, so adapter suites can adopt the shared factories and matchers. Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Replace the local mockLogger/createMockState/createMockChatInstance and inline logger literals with the shared factories, convert call sites to the options-based createMockChatInstance, and adopt toHaveDispatched. Keeps the bespoke createMockStateAdapter (uses .storage + constrained spy behavior) and the Google SDK mocks local. Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Replace the local mockLogger/createMockChat with the shared factories (createMockChat kept as a thin wrapper preserving userName + logger wiring) and adopt not.toHaveDispatched for the echo-message cases. Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Replace the inline mock chat/state objects in index.test.ts with the shared createMockChatInstance/createMockState (seeding the aadObjectId via state.cache), dropping redundant casts. Platform SDK mocks stay local. Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Replace the inline mockChat and no-op loggers with createMockChatInstance / createMockLogger, drop the now-unneeded casts, and adopt not.toHaveDispatched. Keeps fetch/HMAC and getList history stubs local. Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Replace the local mockLogger with the shared singleton and delegate createMockChat to createMockChatInstance (thin wrapper preserving the "mybot" default), and adopt not.toHaveDispatched for the clean cases. Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Remove the local mockLogger literals and the gateway mockChat object, replace ~20 inline `as unknown as ChatInstance` mocks with createMockChatInstance() (overrides where needed), and adopt not.toHaveDispatched for the clean case. discord.js mocks stay local. Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Replace the inline mockChat() helper with createMockChatInstance() and drop the now-unused ChatInstance import. Twilio fetch/credential mocks stay local. Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Remove the local createMockLogger/createMockState/createMockChatInstance, import the shared ones, convert 35 positional createMockChatInstance call sites to the options API, and adopt toHaveDispatched. LinearClient mocks and the Phase 1 connectWebhookContract descriptor stay intact. Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Replace the local mockLogger/createMockState and 17 inline mock-chat literals with the shared factories, and adopt not.toHaveDispatched. Octokit mocks and the Phase 1 connectWebhookContract descriptor stay intact. Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Remove the local mockLogger/createMockState/createMockChatInstance, import the shared ones, convert 100 positional createMockChatInstance call sites to the options API, and adopt toHaveDispatched for the clean cases. WebClient/socket-mode mocks and the Phase 1 connectWebhookContract descriptor stay intact. Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wires
@chat-adapter/testsas a devDependency and registers its matchers viasetupFiles: ["@chat-adapter/tests/setup"]across all 11 platform adapters, then replaces bespoke localmockLogger/createMockState/createMockChatInstancewith the shared factories and adoptstoHaveDispatched/not.toHaveDispatchedwhere clean.createMockChatInstance(...)call sites converted to the options API (slack 100, linear 35).webleft as-is — its suite uses the realChat/createMemoryStatefor e2e, so the shared factories don't apply.@linear/sdk,fetch) and the Phase 1connectWebhookContractdescriptors are left intact.Net ~−540 lines of duplicated test scaffolding. Stacked on #673. Tests-only, no changeset.