feat(blog): enable live likes and first-party views

This commit is contained in:
DeCentN2Madness authored and AIAMarketing committed 2026-11-06 10:54:18 -07:00
1 parent 89cdb00765
commit 8c19266760
13 files changed
+631 -30

No files matched your search

+12 -7
View File
@@ -20,7 +20,7 @@ test('counter configuration defaults off and requires explicit approval', () =>
assert.equal(resolveCounterConfig('live', 'https://api.example.test', 'false').mode, 'off');
assert.equal(resolveCounterConfig('live', 'https://api.example.test', 'true').mode, 'live');
assert.equal(resolveCounterConfig('live', 'http://api.example.test', 'true').mode, 'off');
assert.equal(counterModeForRuntime(resolveCounterConfig('live', 'https://api.example.test', 'true')), 'off');
assert.equal(counterModeForRuntime(resolveCounterConfig('live', 'https://api.example.test', 'true')), 'live');
assert.equal(resolveCounterConfig('mock', undefined, undefined).mode, 'mock');
});
@@ -73,10 +73,15 @@ test('inactive source has no native form or live vendor destination', () => {
assert.match(sources, /data-form-mode/);
});
test('counter source has no implicit production fallback or credentialed fetch', () => {
const source = fs.readFileSync('src/components/LikeViewCounter.astro', 'utf8');
assert.doesNotMatch(source, /api\.azinstitute4autism\.com/);
assert.doesNotMatch(source, /credentials:\s*['"]include/);
assert.doesNotMatch(source, /method:\s*['"](?:POST|DELETE)/);
assert.match(source, /data-counter-mode/);
test('counter source requires explicit live configuration and omits credentials', () => {
const component = fs.readFileSync('src/components/LikeViewCounter.astro', 'utf8');
const runtime = fs.readFileSync('src/scripts/likes-views.ts', 'utf8');
const deploy = fs.readFileSync('tools/deploy.mjs', 'utf8');
assert.doesNotMatch(component, /api\.azinstitute4autism\.com/);
assert.doesNotMatch(runtime, /credentials:\s*['"]include/);
assert.match(runtime, /credentials:\s*['"]omit/);
assert.match(component, /data-counter-mode/);
assert.match(deploy, /PUBLIC_COUNTERS_MODE:\s*'live'/);
assert.match(deploy, /PUBLIC_COUNTERS_LIVE_APPROVED:\s*'true'/);
assert.match(deploy, /PUBLIC_AIA_API_BASE:\s*'https:\/\/api\.azinstitute4autism\.com'/);
});