fde6503bdf
Memind CI / Test, build, and release guards (push) Has been cancelled
Enable optional SEO/GEO injection and discovery routes for confirmed public pages while keeping private pages noindex. Add premium page template skills, portal catalog API, template shop UI, and Baidu push gated by memind_adm config. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import {
|
|
buildGeoStructuredData,
|
|
injectGeoTags,
|
|
} from './mindspace-geo-tags.mjs';
|
|
|
|
test('buildGeoStructuredData returns Article schema', () => {
|
|
const html = `<!doctype html><html><head>
|
|
<title>仙居玩水</title>
|
|
<meta name="description" content="淡竹白溪攻略">
|
|
</head><body><h1>仙居玩水</h1></body></html>`;
|
|
const payload = buildGeoStructuredData(html, {
|
|
origin: 'https://m.tkmind.cn',
|
|
pageUrl: 'https://m.tkmind.cn/u/john/pages/demo',
|
|
publication: { publicUrl: '/u/john/pages/demo' },
|
|
});
|
|
assert.equal(payload['@type'], 'Article');
|
|
assert.equal(payload.headline, '仙居玩水');
|
|
assert.match(payload.description, /淡竹白溪/);
|
|
});
|
|
|
|
test('injectGeoTags appends json-ld script', () => {
|
|
const html = '<html><head><title>Demo</title></head><body></body></html>';
|
|
const next = injectGeoTags(html, {
|
|
origin: 'https://m.tkmind.cn',
|
|
pageUrl: 'https://m.tkmind.cn/u/john/pages/demo',
|
|
});
|
|
assert.match(next, /<script type="application\/ld\+json">/);
|
|
});
|