@deepseek-ai/dsh-client-test-runtime 0.1.0-rc.7 → 0.1.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/index.js +19 -3
- package/lib/types/index.d.ts +14 -2
- package/package.json +13 -13
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/test-support/client-runtime/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 443cadb63d2e290874d7248d7fb104c7340d55c7
|
|
6
|
+
README.zh.md: 596f6a90f1223a6108fd09b66c1451539c8ce1fd
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
jsdom slot test runtime for client feature specs: a real Cordis `Context`, the production `SlotRegistry` and
|
|
5
|
+
jsdom slot test runtime for client feature specs: a real Cordis `Context`, the production `SlotRegistry` and UI renderer, assembled around typed session/workspace doubles. Feature suites exercise declaration, registration, scope, store, inject, rendering, updates, and disposal without hand-building the machinery per suite — and without a second implementation of any production logic.
|
|
6
6
|
|
|
7
7
|
The doubles implement the same outward faces features receive through ctx (`TestSessions implements ISessions`, `TestWorkspaces implements IWorkspaces`; each fixture session is a `FixtureSession implements SessionFace`; `stubSettingsScope` is a `SettingsScope` with test-driven publications and a write spy), so a production face change breaks the bench at compile time instead of silently drifting. Provide-bundle materialization runs the production `SessionProvideChannel` — the one implementation shared with `SessionRuntime`. Fixtures feed plain data: list rows, conversation snapshots (immer-patched via `updateSnapshot`), projection values, and `ISession`-typed behavior stubs that fail loud when a spec calls an unstubbed verb. The typed `provide()` constrains fakes for declared service names to `Partial` of that service's outward face.
|
|
8
8
|
|
package/README.zh.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
面向客户端功能测试的 jsdom slot 测试运行时:真实 Cordis `Context`、生产 `SlotRegistry` 与
|
|
5
|
+
面向客户端功能测试的 jsdom slot 测试运行时:真实 Cordis `Context`、生产 `SlotRegistry` 与 UI 渲染器,围绕带类型的 session/workspace 测试替身组装。功能套件无需逐套件手搭机器即可测遍声明、注册、scope、store、inject、渲染、更新与销毁——且不存在任何生产逻辑的第二份实现。
|
|
6
6
|
|
|
7
7
|
替身实现的正是功能通过 ctx 获得的对外接口(`TestSessions implements ISessions`、`TestWorkspaces implements IWorkspaces`;每个 fixture session 是 `FixtureSession implements SessionFace`;`stubSettingsScope` 是发布由测试驱动、带写入 spy 的 `SettingsScope`),生产面一旦改形,测试台在编译期即断,而非静默漂移。provide bundle 材料化直接运行生产 `SessionProvideChannel`——与 `SessionRuntime` 共用同一份实现。fixture 灌入的是普通数据:列表行、会话快照(经 `updateSnapshot` 以 immer 补丁改写)、projection 值,以及按 `ISession` 取型的行为桩——spec 调用未打桩的动词时报错自明。带类型的 `provide()` 将已声明服务名的 fake 约束为该服务对外面的 `Partial` 子集。
|
|
8
8
|
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,8 @@ import { Context, Inject } from "@deepseek-ai/cordis";
|
|
|
2
2
|
import { Fragment, createElement, useSyncExternalStore } from "react";
|
|
3
3
|
import { act, render, within } from "@testing-library/react";
|
|
4
4
|
import { ConversationEventRegistry, ConversationViewRegistry, EMPTY_CHAT_SNAPSHOT, EMPTY_CONVERSATION_VIEWS, SessionProvideChannel, SlotRegistry, createScope, createSnapshotStore, scopeOf } from "@deepseek-ai/dsh-client-runtime/client";
|
|
5
|
-
import {
|
|
5
|
+
import { bindSnapshotSelector as bindSnapshotSelector$1 } from "@deepseek-ai/dsh-client-ui-renderer/src/client/bind.ts";
|
|
6
|
+
import { createSlotRenderer as createSlotRenderer$1 } from "@deepseek-ai/dsh-client-ui-renderer/src/client/scoped-slots.tsx";
|
|
6
7
|
import { afterEach, beforeEach, expect, vi } from "vitest";
|
|
7
8
|
import { SESSION_SEARCH_RESULT_LIMIT } from "@deepseek-ai/dsh-host-apiproxy/api";
|
|
8
9
|
//#region lib/types/snapshot.js
|
|
@@ -1053,7 +1054,7 @@ function usePinnedBrowserLanguages(primary, ...rest) {
|
|
|
1053
1054
|
//#region lib/types/index.js
|
|
1054
1055
|
/**
|
|
1055
1056
|
* jsdom slot test runtime: a real small runtime — Cordis `Context`, the
|
|
1056
|
-
* runtime `SlotRegistry`, and the
|
|
1057
|
+
* runtime `SlotRegistry`, and the UI renderer — assembled around
|
|
1057
1058
|
* test-owned session/workspace doubles, so feature specs exercise
|
|
1058
1059
|
* declaration, registration, scope, store, inject, rendering, updates, and
|
|
1059
1060
|
* disposal without hand-building the machinery per suite.
|
|
@@ -1064,6 +1065,21 @@ function usePinnedBrowserLanguages(primary, ...rest) {
|
|
|
1064
1065
|
* @module @deepseek-ai/dsh-client-test-runtime
|
|
1065
1066
|
*/
|
|
1066
1067
|
/**
|
|
1068
|
+
* Bind an observable source to the production renderer's selector hook.
|
|
1069
|
+
* @param source - Observable snapshot source.
|
|
1070
|
+
* @returns Typed React selector hook.
|
|
1071
|
+
*/
|
|
1072
|
+
function bindSnapshotSelector(source) {
|
|
1073
|
+
return bindSnapshotSelector$1(source);
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Create the production slot renderer used by client feature tests.
|
|
1077
|
+
* @returns Slot renderer instance.
|
|
1078
|
+
*/
|
|
1079
|
+
function createSlotRenderer() {
|
|
1080
|
+
return createSlotRenderer$1();
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1067
1083
|
* Owner-props cell behind the auto frame: one external store the frame
|
|
1068
1084
|
* subscribes to, so {@link SlotTestRuntime.renderSlot} and
|
|
1069
1085
|
* {@link SlotView.update} drive React through the standard uSES boundary.
|
|
@@ -1335,4 +1351,4 @@ var SlotTestRuntime = class SlotTestRuntime {
|
|
|
1335
1351
|
}
|
|
1336
1352
|
};
|
|
1337
1353
|
//#endregion
|
|
1338
|
-
export { FixtureSession, SlotTestRuntime, TestRemote, TestRoot, TestSessions, TestWorkspaces, conversationSnapshot, domSnapshotSerializer, makeTranslate, registerDomSnapshotSerializer, stubSettingsScope, usePinnedBrowserLanguages, workspaceListState };
|
|
1354
|
+
export { FixtureSession, SlotTestRuntime, TestRemote, TestRoot, TestSessions, TestWorkspaces, bindSnapshotSelector, conversationSnapshot, createSlotRenderer, domSnapshotSerializer, makeTranslate, registerDomSnapshotSerializer, stubSettingsScope, usePinnedBrowserLanguages, workspaceListState };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* jsdom slot test runtime: a real small runtime — Cordis `Context`, the
|
|
3
|
-
* runtime `SlotRegistry`, and the
|
|
3
|
+
* runtime `SlotRegistry`, and the UI renderer — assembled around
|
|
4
4
|
* test-owned session/workspace doubles, so feature specs exercise
|
|
5
5
|
* declaration, registration, scope, store, inject, rendering, updates, and
|
|
6
6
|
* disposal without hand-building the machinery per suite.
|
|
@@ -16,10 +16,11 @@ import type { RenderResult } from '@testing-library/react';
|
|
|
16
16
|
import type { queries } from '@testing-library/dom';
|
|
17
17
|
import type { BoundFunctions } from '@testing-library/dom';
|
|
18
18
|
import { SlotRegistry } from '@deepseek-ai/dsh-client-runtime/client';
|
|
19
|
-
import type { ChildrenDecl, ComposedProps, OwnerOf, SlotComponent, SlotMap, StoreInstanceLike } from '@deepseek-ai/dsh-client-ui-slots';
|
|
19
|
+
import type { ChildrenDecl, ComposedProps, HostObservable, OwnerOf, SlotComponent, SlotMap, SlotRenderer, SnapshotSelectorHook, StoreInstanceLike } from '@deepseek-ai/dsh-client-ui-slots';
|
|
20
20
|
import { TestSessions } from './sessions.ts';
|
|
21
21
|
import { TestWorkspaces } from './workspaces.ts';
|
|
22
22
|
import type { Stabilizer } from './fixtures.ts';
|
|
23
|
+
export type { UseSession } from '@deepseek-ai/dsh-client-ui-renderer/client';
|
|
23
24
|
export { domSnapshotSerializer, registerDomSnapshotSerializer } from './snapshot.ts';
|
|
24
25
|
export { FixtureSession, TestSessions } from './sessions.ts';
|
|
25
26
|
export { stubSettingsScope } from './settings-scope.ts';
|
|
@@ -30,6 +31,17 @@ export { conversationSnapshot, workspaceListState } from './fixtures.ts';
|
|
|
30
31
|
export type { SessionBehaviorOverrides, SessionFixture, Stabilizer } from './fixtures.ts';
|
|
31
32
|
export { makeTranslate } from './translate.ts';
|
|
32
33
|
export { usePinnedBrowserLanguages } from './locale-env.ts';
|
|
34
|
+
/**
|
|
35
|
+
* Bind an observable source to the production renderer's selector hook.
|
|
36
|
+
* @param source - Observable snapshot source.
|
|
37
|
+
* @returns Typed React selector hook.
|
|
38
|
+
*/
|
|
39
|
+
export declare function bindSnapshotSelector<T>(source: HostObservable<T>): SnapshotSelectorHook<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Create the production slot renderer used by client feature tests.
|
|
42
|
+
* @returns Slot renderer instance.
|
|
43
|
+
*/
|
|
44
|
+
export declare function createSlotRenderer(): SlotRenderer;
|
|
33
45
|
/**
|
|
34
46
|
* One rendered slot's local view, from {@link SlotTestRuntime.renderSlot}:
|
|
35
47
|
* the renderer's own `[data-slot]` outlet anchor is the snapshot root
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-client-test-runtime",
|
|
3
|
-
"description": "jsdom slot test runtime: real Cordis Context + SlotRegistry +
|
|
4
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"description": "jsdom slot test runtime: real Cordis Context + SlotRegistry + UI renderer with test-owned session/workspace doubles for feature specs",
|
|
4
|
+
"version": "0.1.0-rc.8",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": "^18.2.0",
|
|
36
36
|
"react-dom": "^18.2.0",
|
|
37
|
-
"@deepseek-ai/dsh-client-
|
|
38
|
-
"@deepseek-ai/dsh-client-
|
|
39
|
-
"@deepseek-ai/dsh-
|
|
40
|
-
"@deepseek-ai/dsh-
|
|
41
|
-
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.
|
|
37
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.8",
|
|
38
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.0-rc.8",
|
|
39
|
+
"@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.8",
|
|
40
|
+
"@deepseek-ai/dsh-host-apiproxy": "^0.1.0-rc.8",
|
|
41
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.8",
|
|
42
42
|
"@deepseek-ai/cordis": "^4.0.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"@types/react-dom": "~18.3.0",
|
|
47
47
|
"react": "^18.2.0",
|
|
48
48
|
"react-dom": "^18.2.0",
|
|
49
|
-
"@deepseek-ai/dsh-client-
|
|
50
|
-
"@deepseek-ai/dsh-client-ui-
|
|
51
|
-
"@deepseek-ai/dsh-
|
|
52
|
-
"@deepseek-ai/dsh-
|
|
53
|
-
"@deepseek-ai/
|
|
54
|
-
"@deepseek-ai/
|
|
49
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.8",
|
|
50
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.0-rc.8",
|
|
51
|
+
"@deepseek-ai/dsh-host-apiproxy": "^0.1.0-rc.8",
|
|
52
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.8",
|
|
53
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
54
|
+
"@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.8"
|
|
55
55
|
},
|
|
56
56
|
"files": [
|
|
57
57
|
"lib/index.js",
|