Implemented SessionManager and TextChannelService + several improvements and fixes
All checks were successful
Setup testing environment and test the code / build (push) Successful in 1m13s

This commit is contained in:
2026-04-08 13:21:11 +02:00
parent a9322e3454
commit 0b38b002df
14 changed files with 666 additions and 17 deletions

View File

@@ -0,0 +1,29 @@
import {describe, expect, it} from "vitest";
import {DMService} from "./dmService";
import {DatabaseMock} from "../mocks/storage/database";
import {faker} from "@faker-js/faker/locale/en";
describe("DmService", () => {
const service = new DMService("", "", "", new DatabaseMock(), () => {})
it("should get messages", async () => {
const messages = await service.get()
expect(messages[0].message).toBe("This is a message")
})
it('should get message position', async () => {
const pos = await service.getMessagePos("")
expect(pos).toBe(5000)
});
it('should get pinned messages', async () => {
const pinnedMessages = await service.getPinnedMessages()
expect(pinnedMessages[0].message).toBe("This is a pinned message")
});
it('should send a new message', async () => {
const message = faker.internet.displayName()
const newMessage = await service.sendMessage(message)
expect(newMessage.message).toBe(message)
});
})