Files
deepseek-harness/packages/experimental/liveshare-protocol/tests/entrypoints.spec.ts
T
mektpoy c682dfaa3b refactor(liveshare-protocol): publish one entry point
The root entry already re-exports the wire codecs, the identity contract, the
viewer carrier, and the viewer-state vocabulary, so `./protocol` and
`./identity` were aliases of subsets that every consumer had to mirror in the
tsconfig path list. Keep `.` alone, keep the mock provider in its source module
for tests, and bundle only the root.
2026-10-23 16:13:34 +08:00

24 lines
1.2 KiB
TypeScript

/** The package's single public entry carries the whole shared contract. */
import { expect, it } from 'vitest'
import * as root from '@deepseek-ai/dsh-experimental-liveshare-protocol'
import { MockIdentityProvider } from '../src/identity/mock.ts'
it('publishes the wire, identity, carrier, and viewer-state contracts from the package root', () => {
expect(root.LIVESHARE_PROTOCOL_VERSION).toBeTypeOf('number')
expect(root.parseShareAccessState).toBeTypeOf('function')
expect(root.parseTunnelWorkerCommand).toBeTypeOf('function')
expect(root.identityKeyOf({ providerId: 'p', tenantId: 't', subjectId: 's' })).toBe('p:t:s')
expect(root.identityFromKey('p:t:s')).toEqual({ providerId: 'p', tenantId: 't', subjectId: 's' })
expect(root.identityFromKey('p:t')).toBeUndefined()
expect(root.identityFromKey('p::s')).toBeUndefined()
expect(root.viewerCarrierScript).toBeTypeOf('function')
expect(root.VIEWER_STATE_REACH).toBeTypeOf('object')
})
it('keeps the mock identity provider out of the published surface', () => {
// Tests import the mock from its source module; no package entry exposes it.
expect('MockIdentityProvider' in root).toBe(false)
expect(MockIdentityProvider).toBeTypeOf('function')
})