Files
SDK-TypeScript/src/services/chatService.test.ts
chatenium 4a34d73c2f
Some checks failed
Setup testing environment and test the code / build (push) Has been cancelled
Code quality improvements and cleanup + Implemented ChatService
2026-04-05 15:19:55 +02:00

24 lines
857 B
TypeScript

import {describe, expect, it} from "vitest";
import {ChatService} from "./chatService";
import {DatabaseMock} from "../mocks/storage/database";
import {faker} from "@faker-js/faker/locale/en";
describe("ChatService", () => {
const service = new ChatService("", "", new DatabaseMock(), (action, data) => {})
it('should get chats', async () => {
const chats = await service.get()
expect(chats[0].userid).toBe("chatPartnerId")
})
it('should get availability', async () => {
const available = await service.getUserAvailability("")
expect(available).toBeTruthy()
});
it('should create a new chat', async () => {
const chatPartnerName = faker.internet.displayName()
const newChat = await service.startNew(chatPartnerName)
expect(newChat.username).toBe(chatPartnerName)
});
})