feat: cut over rust web main shell
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildSearchRequest } from "./request";
|
||||
import { SEARCH_REQUEST_TRANSPORT_CONTRACT, buildSearchRequest } from "./request";
|
||||
|
||||
describe("buildSearchRequest", () => {
|
||||
it("combines标题过滤与时间范围", () => {
|
||||
@@ -42,4 +42,44 @@ describe("buildSearchRequest", () => {
|
||||
expect(payload?.filters.onlyCurrentPage).toBe(false);
|
||||
expect(payload?.documentId).toBeUndefined();
|
||||
});
|
||||
|
||||
it("固定搜索请求将由 Rust Web search.documents transport 拥有", () => {
|
||||
const payload = buildSearchRequest({
|
||||
workspaceId: "ws-3",
|
||||
activeDocumentId: "doc-3",
|
||||
query: "Rust Web",
|
||||
filters: {
|
||||
titleOnly: false,
|
||||
exact: true,
|
||||
onlyCurrentPage: true,
|
||||
includeOcr: true,
|
||||
timeField: "updated",
|
||||
customRange: undefined,
|
||||
},
|
||||
timeRange: "any",
|
||||
});
|
||||
|
||||
expect(payload).toMatchObject({
|
||||
workspaceId: "ws-3",
|
||||
documentId: "doc-3",
|
||||
query: "Rust Web",
|
||||
filters: {
|
||||
exact: true,
|
||||
includeOcr: true,
|
||||
onlyCurrentPage: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("SEARCH_REQUEST_TRANSPORT_CONTRACT", () => {
|
||||
it("搜索请求 contract 固定为 Rust Web transport", () => {
|
||||
expect(SEARCH_REQUEST_TRANSPORT_CONTRACT).toEqual({
|
||||
shellOwner: "mnote-web",
|
||||
queryName: "search.documents",
|
||||
endpoint: "/api/search/documents",
|
||||
runtimeRole: "rust_web_transport",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user