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>
52 lines
2.1 KiB
JavaScript
52 lines
2.1 KiB
JavaScript
/**
|
|
* Renderer Runner — renderer/contract suite
|
|
*
|
|
* Tests the sw.renderers registry contract.
|
|
* Requires mermaid-renderer to be installed and loaded.
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
|
|
sw.testing.suite('renderer/contract', async function (s) {
|
|
|
|
s.test('sw.renderers exists', async function (t) {
|
|
t.assert.ok(sw.renderers, 'sw.renderers is defined');
|
|
t.assert.ok(typeof sw.renderers.register === 'function', 'register is a function');
|
|
t.assert.ok(typeof sw.renderers.list === 'function', 'list is a function');
|
|
t.assert.ok(typeof sw.renderers.runBlockRenderers === 'function', 'runBlockRenderers is a function');
|
|
t.assert.ok(typeof sw.renderers.runPostRenderers === 'function', 'runPostRenderers is a function');
|
|
});
|
|
|
|
s.test('mermaid renderer registered', async function (t) {
|
|
var info = sw.renderers.list();
|
|
t.assert.ok(info.block, 'block renderers list exists');
|
|
t.assert.ok(Array.isArray(info.block), 'block is array');
|
|
var mermaid = info.block.find(function (r) { return r.name === 'mermaid'; });
|
|
if (!mermaid) {
|
|
t.warn('Mermaid renderer not found in block list — extension may not have loaded yet');
|
|
return;
|
|
}
|
|
t.assert.ok(mermaid, 'mermaid renderer found');
|
|
t.assert.eq(mermaid.pattern, 'mermaid', 'pattern matches "mermaid"');
|
|
});
|
|
|
|
s.test('block renderer match', async function (t) {
|
|
// Test that runBlockRenderers returns true for 'mermaid' lang
|
|
// We need a container element for the render call
|
|
t.browserOnly(function () {
|
|
var container = document.createElement('div');
|
|
var handled = sw.renderers.runBlockRenderers('mermaid', 'graph LR; A-->B', container);
|
|
t.assert.ok(handled, 'mermaid block was handled by a renderer');
|
|
});
|
|
});
|
|
|
|
s.test('unmatched block returns false', async function (t) {
|
|
t.browserOnly(function () {
|
|
var container = document.createElement('div');
|
|
var handled = sw.renderers.runBlockRenderers('nonexistent-lang-xyz', 'code', container);
|
|
t.assert.eq(handled, false, 'unmatched lang returns false');
|
|
});
|
|
});
|
|
});
|
|
})();
|