test(etapi): port search

This commit is contained in:
Elian Doran
2025-06-02 21:16:57 +03:00
parent 4e81be8c76
commit 95641a3b6d
3 changed files with 57 additions and 39 deletions

View File

@@ -14,3 +14,20 @@ export async function login(app: Application) {
expect(token).toBeTruthy();
return token;
}
export async function createNote(app: Application, token: string, content?: string) {
const response = await supertest(app)
.post("/etapi/create-note")
.auth("etapi", token, { "type": "basic"})
.send({
"parentNoteId": "root",
"title": "Hello",
"type": "text",
"content": content ?? "Hi there!",
})
.expect(201);
const noteId = response.body.note.noteId;
expect(noteId).toStrictEqual(noteId);
return noteId;
}