mcp-resource-subscriptions.test.mjs
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d
docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge
Human
11 hours ago
| 1 | import { test } from 'node:test'; |
| 2 | import assert from 'node:assert'; |
| 3 | import path from 'path'; |
| 4 | import { subscriptionCoversUri, vaultRelativePosix } from '../mcp/resource-subscriptions.mjs'; |
| 5 | |
| 6 | test('subscriptionCoversUri prefix match', () => { |
| 7 | assert.strictEqual( |
| 8 | subscriptionCoversUri('knowtation://vault/inbox', 'knowtation://vault/inbox/foo.md'), |
| 9 | true |
| 10 | ); |
| 11 | assert.strictEqual( |
| 12 | subscriptionCoversUri('knowtation://vault/inbox', 'knowtation://vault/inbox'), |
| 13 | true |
| 14 | ); |
| 15 | assert.strictEqual( |
| 16 | subscriptionCoversUri('knowtation://vault/inbox', 'knowtation://vault/captures/x.md'), |
| 17 | false |
| 18 | ); |
| 19 | }); |
| 20 | |
| 21 | test('vaultRelativePosix', () => { |
| 22 | const vault = path.resolve('/tmp/kvault'); |
| 23 | assert.strictEqual(vaultRelativePosix(vault, path.join(vault, 'inbox', 'a.md')), 'inbox/a.md'); |
| 24 | assert.strictEqual(vaultRelativePosix(vault, path.join(vault, '..', 'outside')), null); |
| 25 | }); |
File History
1 commit
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d
docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge
Human
11 hours ago