Code quality improvements and cleanup + Implemented ChatService
Some checks failed
Setup testing environment and test the code / build (push) Has been cancelled
Some checks failed
Setup testing environment and test the code / build (push) Has been cancelled
This commit is contained in:
14
tests/chatsService.test.ts
Normal file
14
tests/chatsService.test.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import {describe, expect, it} from "vitest";
|
||||
import {DatabaseMock} from "../src/mocks/storage/database";
|
||||
import {ChatService} from "../src/services/chatService";
|
||||
|
||||
describe("ChatService Integration Testing", () => {
|
||||
const CHAT_SERVICE_TESTING_USER_ID = "000000000000000000000000"
|
||||
const CHAT_SERVICE_TESTING_TOKEN = "testingToken"
|
||||
const service = new ChatService(CHAT_SERVICE_TESTING_USER_ID, CHAT_SERVICE_TESTING_TOKEN, new DatabaseMock(), () => {})
|
||||
|
||||
it('should get chats', async () => {
|
||||
const chats = await service.get()
|
||||
expect(chats[0].username).toBe("bob")
|
||||
})
|
||||
})
|
||||
@@ -15,7 +15,7 @@ describe("FileUploadService Integration Testing", () => {
|
||||
responseType: 'blob'
|
||||
});
|
||||
|
||||
const service = new FileUploadService(FILE_UPL_SERVICE_TESTING_TOKEN, getClient(false), getClient(true));
|
||||
const service = new FileUploadService(FILE_UPL_SERVICE_TESTING_TOKEN);
|
||||
await service.uploadFiles(
|
||||
FILE_UPL_SERVICE_TESTING_CHAT_ID,
|
||||
FILE_UPL_SERVICE_TESTING_USER_ID,
|
||||
|
||||
@@ -23,7 +23,7 @@ describe("NetworkService Integration Testing", () => {
|
||||
NETWORK_SERVICE_TESTING_TOKEN,
|
||||
NETWORK_SERVICE_TESTING_NETWORK_ID,
|
||||
new DatabaseMock(),
|
||||
getClient(false),
|
||||
(action, data) => {}
|
||||
)
|
||||
|
||||
it("should get invites", async () => {
|
||||
|
||||
@@ -15,9 +15,7 @@ describe("PictureService Integration Test", () => {
|
||||
PICTURE_SERVICE_TESTING_TOKEN,
|
||||
PICTURE_SERVICE_TESTING_USER_ID,
|
||||
PICTURE_SERVICE_TESTING_USER_ID,
|
||||
new DatabaseMock(),
|
||||
getClient(false),
|
||||
getClient(true),
|
||||
new DatabaseMock()
|
||||
)
|
||||
|
||||
it('should get uploads', async () => {
|
||||
|
||||
14
tests/webSocketHandler.test.ts
Normal file
14
tests/webSocketHandler.test.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import {describe, it} from "vitest";
|
||||
import {WebSocketHandler} from "../src/core/webSocketHandler";
|
||||
|
||||
const WEBSOCKET_HANDLER_TESTING_USER_ID = "000000000000000000000000"
|
||||
const WEBSOCKET_HANDLER_TESTING_USER_TOKEN = "testingToken"
|
||||
|
||||
describe("WebSocketHandler", () => {
|
||||
it("should connect", async () => {
|
||||
await WebSocketHandler.getInstance().connect(
|
||||
WEBSOCKET_HANDLER_TESTING_USER_ID,
|
||||
WEBSOCKET_HANDLER_TESTING_USER_TOKEN
|
||||
)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user