Some checks failed
Setup testing environment and test the code / build (push) Has been cancelled
24 lines
857 B
TypeScript
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)
|
|
});
|
|
}) |