[chat] Add chat/test entrypoint for consumer test utilities#352
Draft
[chat] Add chat/test entrypoint for consumer test utilities#352
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Fix channelId bug: counter now always increments per call
- Un-export ThreadImplConfigWithAdapter, define standalone CreateTestThreadOptions
- Split adapter into adapter?: string + adapterOverrides?: Partial<Adapter>
- Return { thread, mockAdapter, mockState } instead of Object.assign
- Shrink public surface: only export createTestThread, createTestMessage, and types
…ions from it Eliminates field duplication between ThreadImplConfigWithAdapter, ThreadImplConfigLazy, and CreateTestThreadOptions by extracting shared fields into a stable public BaseThreadOptions type.
Build overrides object conditionally so metadata and author keys are only present when explicitly provided by the caller.
- Un-export BaseThreadOptions (stays as internal dedup only) - Define CreateTestThreadOptions explicitly, no derived types - Return Thread interface instead of ThreadImpl in TestThread - No internal types leak through the generated .d.ts
Not needed for chat/test. Keep the PR strictly scoped to the new entrypoint without touching existing internal types.
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.
Exposes the existing internal test utilities via a
chat/testentrypoint so consumers can create type-safeThreadandMessageinstances withoutfromPartialor manual mock construction. When the SDK's interfaces change, these factories are updated in the same release — consumers just bump the dependency.createTestThreadconstructs a realThreadImplbacked by a mock adapter with spyable methods. Acceptsadapteras a string (name) or object (name + overrides likebotUserId). AllThreadImplConfigWithAdapterfields are accepted as optional overrides.createTestMessageconstructs a realMessageinstance. Onlytextis required —id,author,raw, and anyMessageDatafields are optional with sensible defaults.vitestis an optional peer dependency — consumers need it installed for thevi.fn()spies.