etapi test infrastructure plus a basic note creation test

This commit is contained in:
zadam
2023-10-29 23:24:11 +01:00
parent 690caf7da1
commit 8690228d98
5 changed files with 173 additions and 4 deletions

27
spec/etapi/notes.js Normal file
View File

@@ -0,0 +1,27 @@
const {describeEtapi, postEtapi, getEtapi, getEtapiContent} = require("../support/etapi");
describeEtapi("notes", () => {
it("create", async () => {
const {note, branch} = await postEtapi('create-note', {
parentNoteId: 'root',
type: 'text',
title: 'Hello World!',
content: 'Content',
prefix: 'Custom prefix'
});
expect(note.title).toEqual("Hello World!");
expect(branch.parentNoteId).toEqual("root");
expect(branch.prefix).toEqual("Custom prefix");
const rNote = await getEtapi(`notes/${note.noteId}`);
expect(rNote.title).toEqual("Hello World!");
const rContent = await getEtapiContent(`notes/${note.noteId}/content`);
expect(rContent).toEqual("Content");
const rBranch = await getEtapi(`branches/${branch.branchId}`);
expect(rBranch.parentNoteId).toEqual("root");
expect(rBranch.prefix).toEqual("Custom prefix");
});
});