Feat v0.7.2 package runners ci gate (#56)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-go-pg (push) Successful in 2m39s
CI/CD / test-sqlite (push) Successful in 2m55s
CI/CD / build-and-deploy (push) Successful in 29s
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-go-pg (push) Successful in 2m39s
CI/CD / test-sqlite (push) Successful in 2m55s
CI/CD / build-and-deploy (push) Successful in 29s
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #56.
This commit is contained in:
59
packages/notes-runner/js/folders.js
Normal file
59
packages/notes-runner/js/folders.js
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Notes Runner — notes/folders suite
|
||||
*
|
||||
* Tests folder CRUD and note-folder association.
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var api = window.NR.api;
|
||||
|
||||
sw.testing.suite('notes/folders', async function (s) {
|
||||
var folderId, noteId;
|
||||
|
||||
s.test('create folder', async function (t) {
|
||||
var r = await api.post('/folders', {
|
||||
name: 'runner-test-folder-' + Date.now()
|
||||
});
|
||||
t.assert.ok(r.id, 'folder has id');
|
||||
t.assert.ok(r.name, 'folder has name');
|
||||
folderId = r.id;
|
||||
s.track('folder', folderId);
|
||||
});
|
||||
|
||||
s.test('create note in folder', async function (t) {
|
||||
t.assert.ok(folderId, 'folderId from previous test');
|
||||
var r = await api.post('/notes', {
|
||||
title: 'Folder Note',
|
||||
body: 'Note in test folder',
|
||||
folder_id: folderId
|
||||
});
|
||||
t.assert.ok(r.id, 'note has id');
|
||||
t.assert.eq(r.folder_id, folderId, 'note assigned to folder');
|
||||
noteId = r.id;
|
||||
s.track('note', noteId);
|
||||
});
|
||||
|
||||
s.test('move note to folder', async function (t) {
|
||||
var f2 = await api.post('/folders', {
|
||||
name: 'runner-move-target-' + Date.now()
|
||||
});
|
||||
s.track('folder', f2.id);
|
||||
|
||||
t.assert.ok(noteId, 'noteId from previous test');
|
||||
await api.post('/notes/move', {
|
||||
note_id: noteId,
|
||||
folder_id: f2.id
|
||||
});
|
||||
var note = await api.get('/notes/' + noteId);
|
||||
t.assert.eq(note.folder_id, f2.id, 'note moved to new folder');
|
||||
});
|
||||
|
||||
s.test('list folders', async function (t) {
|
||||
var r = await api.get('/folders');
|
||||
t.assert.ok(Array.isArray(r), 'response is array');
|
||||
var found = r.some(function (f) { return f.id === folderId; });
|
||||
t.assert.ok(found, 'created folder appears in list');
|
||||
});
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user