refactor(data): replace schema classes with readonly models
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { DEFAULT_CHARACTER_ID } from "@/data/constants/character";
|
||||
import { ChatSendResponse } from "@/data/schemas/chat";
|
||||
import {
|
||||
ChatSendResponseSchema,
|
||||
type ChatSendResponse,
|
||||
type ChatSendResponseInput,
|
||||
} from "@/data/schemas/chat";
|
||||
import type { ChatState } from "@/stores/chat/chat-state";
|
||||
import {
|
||||
applyNetworkHistoryLoadedOutput,
|
||||
applyHttpSendOutput,
|
||||
applyNetworkHistoryLoadedOutput,
|
||||
countLockedHistoryMessages,
|
||||
localMessagesToUi,
|
||||
sendResponseToUiMessage,
|
||||
} from "@/stores/chat/helper";
|
||||
|
||||
function makeResponse(
|
||||
overrides: Partial<Parameters<typeof ChatSendResponse.from>[0]> = {},
|
||||
overrides: Partial<ChatSendResponseInput> = {},
|
||||
): ChatSendResponse {
|
||||
return ChatSendResponse.from({
|
||||
return ChatSendResponseSchema.parse({
|
||||
reply: "AI reply",
|
||||
messageId: "msg-1",
|
||||
isGuest: false,
|
||||
@@ -100,9 +104,7 @@ describe("sendResponseToUiMessage", () => {
|
||||
}),
|
||||
);
|
||||
|
||||
expect(message.audioUrl).toBe(
|
||||
"https://example.com/unlocked-voice.mp3",
|
||||
);
|
||||
expect(message.audioUrl).toBe("https://example.com/unlocked-voice.mp3");
|
||||
expect(message.locked).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user