Five package-level test runners validating extension API contracts: - notes-runner: CRUD, folders, tags, search, backlinks (12 tests) - chat-runner: conversations, messaging, search (9 tests) - schedules-runner: CRUD + run (5 tests) - workflow-runner: definitions, instances, stage progression (5 tests) - renderer-runner: registry contract, block matching (4 tests) Runner Result API (in-memory, 3 admin endpoints) stores results from browser runs for CI consumption. Test-runners surface v0.2.0 posts results after each run and fixes suite prefix matching. CI integration via Playwright: wait-for-healthy.sh, run-surface-tests.sh, surface-test-driver.js. New test-runners stage in Gitea CI pipeline. Verified: 169 passed, 0 failed, 9 warned, 8 skipped on fresh install. Go handler tests: 4/4 passing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
64 lines
1.9 KiB
JavaScript
64 lines
1.9 KiB
JavaScript
/**
|
|
* Notes Runner — notes/crud suite
|
|
*
|
|
* Tests basic note CRUD operations via the Notes ext API.
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
|
|
var api = window.NR.api;
|
|
|
|
sw.testing.suite('notes/crud', async function (s) {
|
|
var noteId;
|
|
|
|
s.test('create note', async function (t) {
|
|
var r = await api.post('/notes', {
|
|
title: 'Runner Test Note',
|
|
body: '# Hello from notes-runner\n\nTest body content.'
|
|
});
|
|
t.assert.ok(r.id, 'note has id');
|
|
t.assert.eq(r.title, 'Runner Test Note', 'title matches');
|
|
t.assert.ok(r.body, 'body present');
|
|
t.assert.ok(r.created_at, 'created_at present');
|
|
noteId = r.id;
|
|
s.track('note', noteId);
|
|
});
|
|
|
|
s.test('get note by id', async function (t) {
|
|
t.assert.ok(noteId, 'noteId from previous test');
|
|
var r = await api.get('/notes/' + noteId);
|
|
t.assert.eq(r.id, noteId, 'id matches');
|
|
t.assert.eq(r.title, 'Runner Test Note', 'title matches');
|
|
});
|
|
|
|
s.test('update note', async function (t) {
|
|
t.assert.ok(noteId, 'noteId from previous test');
|
|
var r = await api.put('/notes/' + noteId, {
|
|
title: 'Updated Test Note',
|
|
body: '# Updated\n\nNew body.'
|
|
});
|
|
t.assert.eq(r.title, 'Updated Test Note', 'title updated');
|
|
});
|
|
|
|
s.test('list notes', async function (t) {
|
|
var r = await api.get('/notes');
|
|
t.assert.ok(Array.isArray(r), 'response is array');
|
|
var found = r.some(function (n) { return n.id === noteId; });
|
|
t.assert.ok(found, 'created note appears in list');
|
|
});
|
|
|
|
s.test('delete note', async function (t) {
|
|
t.assert.ok(noteId, 'noteId from previous test');
|
|
await api.del('/notes/' + noteId);
|
|
// Verify gone
|
|
try {
|
|
await api.get('/notes/' + noteId);
|
|
t.assert.ok(false, 'expected 404 after delete');
|
|
} catch (e) {
|
|
t.assert.ok(true, 'note not found after delete');
|
|
}
|
|
noteId = null;
|
|
});
|
|
});
|
|
})();
|