4e789663a1
Memind CI / Test, build, and release guards (push) Failing after 5m19s
Drop the user_confirmed_at gate so public, online, unexpired pages can enter sitemap/llms and receive SEO/GEO tags. Defaults now enable all discovery switches; stored all-off config is still preserved until admin saves. Co-authored-by: Cursor <cursoragent@cursor.com>
76 lines
2.2 KiB
JavaScript
76 lines
2.2 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import {
|
|
isPublicationIndexable,
|
|
resolveIndexPolicy,
|
|
} from './mindspace-index-policy.mjs';
|
|
|
|
const indexablePublication = {
|
|
status: 'online',
|
|
accessMode: 'public',
|
|
userConfirmedAt: Date.now() - 1000,
|
|
expiresAt: null,
|
|
publicUrl: '/u/john/pages/demo',
|
|
};
|
|
|
|
test('isPublicationIndexable accepts confirmed public online publications', () => {
|
|
assert.equal(isPublicationIndexable(indexablePublication), true);
|
|
});
|
|
|
|
test('isPublicationIndexable accepts public online pages without confirmation', () => {
|
|
assert.equal(
|
|
isPublicationIndexable({ ...indexablePublication, userConfirmedAt: null }),
|
|
true,
|
|
);
|
|
});
|
|
|
|
test('isPublicationIndexable rejects private access modes', () => {
|
|
for (const accessMode of ['password', 'private_link', 'login_required', 'owner_only']) {
|
|
assert.equal(
|
|
isPublicationIndexable({ ...indexablePublication, accessMode }),
|
|
false,
|
|
);
|
|
}
|
|
});
|
|
|
|
test('resolveIndexPolicy stays off when master switch disabled', () => {
|
|
const policy = resolveIndexPolicy({
|
|
seoGeoConfig: { enabled: false },
|
|
publication: indexablePublication,
|
|
});
|
|
assert.equal(policy.mode, 'off');
|
|
assert.equal(policy.injectNoindex, false);
|
|
});
|
|
|
|
test('resolveIndexPolicy noindexes non-public publications when enabled', () => {
|
|
const policy = resolveIndexPolicy({
|
|
seoGeoConfig: { enabled: true, seo: { enabled: true }, geo: { enabled: true } },
|
|
publication: { ...indexablePublication, accessMode: 'password' },
|
|
});
|
|
assert.equal(policy.mode, 'noindex');
|
|
assert.equal(policy.injectNoindex, true);
|
|
});
|
|
|
|
test('resolveIndexPolicy marks public online pages indexable', () => {
|
|
const policy = resolveIndexPolicy({
|
|
seoGeoConfig: {
|
|
enabled: true,
|
|
seo: { enabled: true, canonical: true },
|
|
geo: { enabled: true, jsonLd: true },
|
|
},
|
|
publication: indexablePublication,
|
|
});
|
|
assert.equal(policy.mode, 'indexable');
|
|
assert.equal(policy.seoEnabled, true);
|
|
assert.equal(policy.geoEnabled, true);
|
|
});
|
|
|
|
test('resolveIndexPolicy skips embed delivery', () => {
|
|
const policy = resolveIndexPolicy({
|
|
seoGeoConfig: { enabled: true },
|
|
publication: indexablePublication,
|
|
embed: true,
|
|
});
|
|
assert.equal(policy.mode, 'off');
|
|
});
|