Initial commit: Memind H5 portal with MindSpace, Plaza, and agent jobs.
Track application source and tests; exclude local env, user workspaces, and runtime data via .gitignore. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {
|
||||
appendPlazaEmbedQuery,
|
||||
injectPlazaEmbedBootstrap,
|
||||
isPlazaEmbedRequest,
|
||||
publishedPageCspForEmbed,
|
||||
} from './plaza-embed.mjs';
|
||||
|
||||
test('isPlazaEmbedRequest detects embed=plaza', () => {
|
||||
assert.equal(isPlazaEmbedRequest({ embed: 'plaza' }), true);
|
||||
assert.equal(isPlazaEmbedRequest({ embed: 'other' }), false);
|
||||
assert.equal(isPlazaEmbedRequest({}), false);
|
||||
});
|
||||
|
||||
test('appendPlazaEmbedQuery appends query once', () => {
|
||||
assert.equal(
|
||||
appendPlazaEmbedQuery('/u/john/pages/demo'),
|
||||
'/u/john/pages/demo?embed=plaza',
|
||||
);
|
||||
assert.equal(
|
||||
appendPlazaEmbedQuery('/u/john/pages/demo?embed=plaza'),
|
||||
'/u/john/pages/demo?embed=plaza',
|
||||
);
|
||||
});
|
||||
|
||||
test('injectPlazaEmbedBootstrap adds script before closing body', () => {
|
||||
const html = '<!doctype html><html><body><h1>Hi</h1></body></html>';
|
||||
const out = injectPlazaEmbedBootstrap(html);
|
||||
assert.match(out, /plaza-embed-bootstrap/);
|
||||
assert.match(out, /<\/body>/);
|
||||
});
|
||||
|
||||
test('publishedPageCspForEmbed allows inline script', () => {
|
||||
assert.match(publishedPageCspForEmbed(true), /script-src 'unsafe-inline'/);
|
||||
});
|
||||
Reference in New Issue
Block a user