feat(mindspace): add SEO/GEO delivery, page template catalog, and admin hooks
Memind CI / Test, build, and release guards (push) Has been cancelled
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>
This commit is contained in:
@@ -2,14 +2,29 @@ import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
defaultMindSpaceConfig,
|
||||
defaultSeoGeoConfig,
|
||||
ensureMindSpaceConfig,
|
||||
loadMindSpaceConfig,
|
||||
normalizeSeoGeoConfig,
|
||||
updateMindSpaceConfig,
|
||||
} from './mindspace-config.mjs';
|
||||
|
||||
test('defaultMindSpaceConfig falls back to env or 5', () => {
|
||||
assert.equal(defaultMindSpaceConfig({ MINDSPACE_FREE_PUBLIC_PAGE_LIMIT: '8' }).publicPageLimit, 8);
|
||||
assert.equal(defaultMindSpaceConfig({ MINDSPACE_FREE_PUBLIC_PAGE_LIMIT: '0' }).publicPageLimit, 5);
|
||||
assert.deepEqual(defaultMindSpaceConfig().seoGeo, defaultSeoGeoConfig());
|
||||
});
|
||||
|
||||
test('normalizeSeoGeoConfig merges nested switches', () => {
|
||||
const config = normalizeSeoGeoConfig({
|
||||
enabled: true,
|
||||
seo: { enabled: true, sitemap: true },
|
||||
geo: { enabled: true, llmsTxt: true },
|
||||
});
|
||||
assert.equal(config.enabled, true);
|
||||
assert.equal(config.seo.sitemap, true);
|
||||
assert.equal(config.geo.llmsTxt, true);
|
||||
assert.equal(config.seo.baiduPush, false);
|
||||
});
|
||||
|
||||
test('ensureMindSpaceConfig seeds the default row only when empty', async () => {
|
||||
@@ -36,6 +51,14 @@ test('loadMindSpaceConfig merges stored config with fallback', async () => {
|
||||
if (sql.includes('FROM mindspace_config')) {
|
||||
return [[
|
||||
{ key: 'public_page_limit', value: '12' },
|
||||
{
|
||||
key: 'seo_geo_config',
|
||||
value: JSON.stringify({
|
||||
enabled: true,
|
||||
seo: { enabled: true, sitemap: true },
|
||||
geo: { enabled: true, jsonLd: true },
|
||||
}),
|
||||
},
|
||||
{ key: 'ignored', value: '99' },
|
||||
]];
|
||||
}
|
||||
@@ -45,6 +68,9 @@ test('loadMindSpaceConfig merges stored config with fallback', async () => {
|
||||
|
||||
const config = await loadMindSpaceConfig(pool, { env: { MINDSPACE_FREE_PUBLIC_PAGE_LIMIT: '7' } });
|
||||
assert.equal(config.publicPageLimit, 12);
|
||||
assert.equal(config.seoGeo.enabled, true);
|
||||
assert.equal(config.seoGeo.seo.sitemap, true);
|
||||
assert.equal(config.seoGeo.geo.jsonLd, true);
|
||||
});
|
||||
|
||||
test('updateMindSpaceConfig persists a positive integer limit', async () => {
|
||||
|
||||
Reference in New Issue
Block a user