- add CreateServiceOrder component and associated icon assets - create reusable resolveChatSocketUrl utility with comprehensive test cases - update development env config to use production websocket endpoint - fix ChatCardAi layout by replacing inline-block with flex-1 class - refactor ChatMainList websocket initialization to use the new socket utility - switch to using environment variable for access token instead of getAccessToken - correct relative import path for CreateServiceOrder in ChatMainList
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { describe, it } from "node:test";
|
|
import { resolveChatSocketUrl } from "./socketUrl.ts";
|
|
|
|
const locationLike = {
|
|
protocol: "http:",
|
|
host: "localhost:5174",
|
|
};
|
|
|
|
describe("resolveChatSocketUrl", () => {
|
|
it("keeps a complete ws chat endpoint", () => {
|
|
assert.equal(
|
|
resolveChatSocketUrl(
|
|
"wss://onefeel.brother7.cn/ingress/agent/ws/chat",
|
|
locationLike,
|
|
),
|
|
"wss://onefeel.brother7.cn/ingress/agent/ws/chat",
|
|
);
|
|
});
|
|
|
|
it("adds the chat path to a configured websocket origin", () => {
|
|
assert.equal(
|
|
resolveChatSocketUrl("wss://onefeel.brother7.cn", locationLike),
|
|
"wss://onefeel.brother7.cn/ingress/agent/ws/chat",
|
|
);
|
|
});
|
|
|
|
it("adds the chat path to an ingress base path", () => {
|
|
assert.equal(
|
|
resolveChatSocketUrl("/ingress", locationLike),
|
|
"ws://localhost:5174/ingress/agent/ws/chat",
|
|
);
|
|
});
|
|
|
|
it("uses the current host when config is empty", () => {
|
|
assert.equal(
|
|
resolveChatSocketUrl("", locationLike),
|
|
"ws://localhost:5174/ingress/agent/ws/chat",
|
|
);
|
|
});
|
|
});
|