proposal-llm-hosted-prefs.test.mjs
sha256:c2dbf04d56308f3bbf2d06e6d2eb022b8948b1e827195fe525a44e5e18d5f9c0
feat(auth): Phase B Connect cloud agent (RFC 8628) + Hermes…
Human
minor
⚠ breaking
11 days ago
| 1 | import test from 'node:test'; |
| 2 | import assert from 'node:assert/strict'; |
| 3 | import { |
| 4 | effectiveHostedReviewHints, |
| 5 | effectiveHostedEnrich, |
| 6 | } from '../hub/gateway/proposal-llm-store.mjs'; |
| 7 | |
| 8 | /** |
| 9 | * Settings → Backup "Save proposal policy" persists review_hints_enabled / enrich_enabled |
| 10 | * in Netlify Blob; effective*() reads that object. These tests cover env override vs stored prefs |
| 11 | * (not emptyPrefs() — that only supplies defaults when no blob/local file exists yet). |
| 12 | */ |
| 13 | test('effectiveHostedReviewHints / Enrich: use stored true when env unset', async (t) => { |
| 14 | const prevH = process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS; |
| 15 | const prevE = process.env.KNOWTATION_HUB_PROPOSAL_ENRICH; |
| 16 | t.after(() => { |
| 17 | if (prevH === undefined) delete process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS; |
| 18 | else process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS = prevH; |
| 19 | if (prevE === undefined) delete process.env.KNOWTATION_HUB_PROPOSAL_ENRICH; |
| 20 | else process.env.KNOWTATION_HUB_PROPOSAL_ENRICH = prevE; |
| 21 | }); |
| 22 | delete process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS; |
| 23 | delete process.env.KNOWTATION_HUB_PROPOSAL_ENRICH; |
| 24 | |
| 25 | const storedOn = { |
| 26 | proposal_evaluation_required: true, |
| 27 | review_hints_enabled: true, |
| 28 | enrich_enabled: true, |
| 29 | }; |
| 30 | assert.equal(effectiveHostedReviewHints(storedOn), true); |
| 31 | assert.equal(effectiveHostedEnrich(storedOn), true); |
| 32 | }); |
| 33 | |
| 34 | test('explicit env 0 disables even when stored prefs are true', async (t) => { |
| 35 | const prevH = process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS; |
| 36 | const prevE = process.env.KNOWTATION_HUB_PROPOSAL_ENRICH; |
| 37 | t.after(() => { |
| 38 | if (prevH === undefined) delete process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS; |
| 39 | else process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS = prevH; |
| 40 | if (prevE === undefined) delete process.env.KNOWTATION_HUB_PROPOSAL_ENRICH; |
| 41 | else process.env.KNOWTATION_HUB_PROPOSAL_ENRICH = prevE; |
| 42 | }); |
| 43 | process.env.KNOWTATION_HUB_PROPOSAL_REVIEW_HINTS = '0'; |
| 44 | process.env.KNOWTATION_HUB_PROPOSAL_ENRICH = '0'; |
| 45 | const onPrefs = { |
| 46 | proposal_evaluation_required: false, |
| 47 | review_hints_enabled: true, |
| 48 | enrich_enabled: true, |
| 49 | }; |
| 50 | assert.equal(effectiveHostedReviewHints(onPrefs), false); |
| 51 | assert.equal(effectiveHostedEnrich(onPrefs), false); |
| 52 | }); |
File History
1 commit
sha256:93bcf8f9bd56d8c5b9339f4ec73b9ebd66571398d56262d38eedc2cfa9db9882
fix(test): align Band B landing assertion with desktop MCP …
Human
11 days ago