33 lines
941 B
JavaScript
33 lines
941 B
JavaScript
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
|