Implemented SessionManager and TextChannelService + several improvements and fixes
All checks were successful
Setup testing environment and test the code / build (push) Successful in 1m13s
All checks were successful
Setup testing environment and test the code / build (push) Successful in 1m13s
This commit is contained in:
29
src/services/dmService.test.ts
Normal file
29
src/services/dmService.test.ts
Normal 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)
|
||||
});
|
||||
})
|
||||
Reference in New Issue
Block a user