/
githubmirror
/
ChatGPT-Next-Web
Обзор
Документация
Войти
/
githubmirror
/
ChatGPT-Next-Web
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/create-message.test.ts
22 строки
706 B
Ethan Lane
test: add unit tests for createMessage (#6836)
06 июл 2026, 08:59
Не верифицирован
06 июл 2026, 08:59
80f25d3
Код
Авторство
О чём код?
import { createMessage } from "../app/store/chat"; describe("createMessage", () => { test("fills sensible defaults", () => { const msg = createMessage({}); expect(msg.role).toBe("user"); expect(msg.content).toBe(""); expect(typeof msg.id).toBe("string"); expect(msg.id.length).toBeGreaterThan(0); expect(typeof msg.date).toBe("string"); }); test("applies overrides on top of the defaults", () => { const msg = createMessage({ role: "assistant", content: "hi" }); expect(msg.role).toBe("assistant"); expect(msg.content).toBe("hi"); }); test("gives each message a unique id", () => { expect(createMessage({}).id).not.toBe(createMessage({}).id); }); });