Add user and auth tests

This commit is contained in:
Aslan 2025-12-27 13:02:02 +01:00
parent 72d7b22891
commit 4bc3be87b4
15 changed files with 288 additions and 26 deletions

33
tests/community.test.js Normal file
View file

@ -0,0 +1,33 @@
import assert from "node:assert";
import { test } from "node:test";
import { validate } from "uuid";
import { apiGet, apiPost, apiPatch, apiDelete } from "./api.js";
const state = {};
test("can create community", async () => {
state.communityName = "testCommunity";
state.username1 = "testuser1";
state.password1 = "8556";
state.email1 = "testuser1@test.test";
state.username2 = "testuser2";
state.password2 = "8556";
state.email2 = "testuser2@test.test";
const response1 = await apiPost(`auth/login`, {
username: state.username1,
password: state.password1,
});
state.sessionId1 = response1.id;
state.token1 = response1.token;
const response2 = await apiPost(`auth/login`, {
username: state.username2,
password: state.password2,
});
state.sessionId2 = response2.id;
state.token2 = response2.token;
});
// TO-DO: Create community test and code