Files
memind/page-data-delivery-assess.test.mjs
john 73b308af0a fix(page-data): enforce full workspace bind delivery and repair tooling
Prevent false-positive Finish Guard passes and sync-created fake bindings by assessing publication, policy, dataset, injection, and insert smoke before H5 delivery.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-12 15:30:52 +08:00

31 lines
920 B
JavaScript

import assert from 'node:assert/strict';
import test from 'node:test';
import {
buildSmokeInsertRow,
extractInjectedPageIdFromHtml,
} from './page-data-delivery-assess.mjs';
test('extractInjectedPageIdFromHtml reads injected pageId', () => {
const html = `<html><head>
<meta name="mindspace-page-data-page-id" content="page-abc">
<script>window.__MINDSPACE_PAGE_DATA__={"pageId":"page-abc","accessMode":"public"};</script>
</head></html>`;
assert.equal(extractInjectedPageIdFromHtml(html), 'page-abc');
});
test('buildSmokeInsertRow fills insert columns', () => {
const row = buildSmokeInsertRow(
{
datasets: {
dining_survey: {
columns: { insert: ['q1_frequency', 'overall_rating', 'phone'] },
},
},
},
'dining_survey',
);
assert.equal(row.q1_frequency, 'smoke-test');
assert.equal(row.overall_rating, 3);
assert.equal(row.phone, '13800000000');
});