Files
SDK-TypeScript/src/services/chatService.test.ts
chatenium d7422efcf0
All checks were successful
Setup testing environment and test the code / build (push) Successful in 1m2s
Quick-fix
2026-04-08 16:56:09 +02:00

24 lines
863 B
TypeScript

import {describe, expect, it} from "vitest";
import {ChatService} from './chatService.js';
import {DatabaseMock} from '../mocks/storage/database.js';
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)
});
})