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,29 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { createPlazaSeoService, seoInternals } from './plaza-seo.mjs';
|
||||
|
||||
test('normalizeUtm trims and caps length', () => {
|
||||
assert.equal(seoInternals.normalizeUtm(' plaza '), 'plaza');
|
||||
assert.equal(seoInternals.normalizeUtm('x'.repeat(120)).length, 100);
|
||||
});
|
||||
|
||||
test('normalizeEventType accepts landing and signup', () => {
|
||||
assert.equal(seoInternals.normalizeEventType('landing'), 'landing');
|
||||
assert.throws(
|
||||
() => seoInternals.normalizeEventType('click'),
|
||||
(error) => error.code === 'invalid_input',
|
||||
);
|
||||
});
|
||||
|
||||
test('buildPostPublicUrl uses plaza path', () => {
|
||||
assert.equal(
|
||||
seoInternals.buildPostPublicUrl('abc-123', 'https://go.tkmind.cn'),
|
||||
'https://go.tkmind.cn/plaza/p/abc-123',
|
||||
);
|
||||
});
|
||||
|
||||
test('pingBaidu skips when token missing', async () => {
|
||||
const service = createPlazaSeoService(null, { baiduToken: '' });
|
||||
const result = await service.pingBaidu(['https://go.tkmind.cn/plaza/p/1']);
|
||||
assert.equal(result.pushed, false);
|
||||
});
|
||||
Reference in New Issue
Block a user