trying to figure out jest issue.

This commit is contained in:
Jordan Hewitt
2025-01-29 17:17:59 -08:00
parent 0876db2dea
commit 889d898062
18 changed files with 7410 additions and 4790 deletions

View File

@ -9,21 +9,21 @@ describe('Conversation', () => {
beforeEach(() => {
const translator = new Translator("en", "es");
const s1: Speaker = { language: "en", id: "s1" };
const s2: Speaker = { id: "s2", language: "es" }
const s1: Speaker = { language: "en", id: "host" };
const s2: Speaker = { id: "guest", language: "es" }
conversation = new Conversation(translator, s1, s2);
});
it('should add a message to the conversation', () => {
conversation.addMessage({ id: "s1", language: "en" }, "Hello");
conversation.addMessage({ id: "host", language: "en" }, "Hello");
expect(conversation.length).toBe(1);
expect(conversation[0].speaker.id).toEqual("s1");
expect(conversation[0].speaker.id).toEqual("host");
expect(conversation[0].text).toEqual("Hello");
});
it('should translate the last message in the conversation', async () => {
conversation.addMessage({ id: "s1", language: "en" }, "Hello");
conversation.addMessage({ id: "host", language: "en" }, "Hello");
await conversation.translateLast();
expect(conversation[conversation.length - 1].translation).toEqual("Hola");