wikilink.test.mjs
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d
docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge
Human
1 day ago
| 1 | import { describe, it } from 'node:test'; |
| 2 | import assert from 'node:assert/strict'; |
| 3 | import { |
| 4 | findFirstWikilinkToTargetInBody, |
| 5 | vaultBasenameTargetKey, |
| 6 | wikilinkTargetKey, |
| 7 | } from '../lib/wikilink.mjs'; |
| 8 | |
| 9 | describe('lib/wikilink.mjs', () => { |
| 10 | it('vaultBasenameTargetKey matches basename stem', () => { |
| 11 | assert.equal(vaultBasenameTargetKey('projects/x/My-Note.md'), 'my-note'); |
| 12 | }); |
| 13 | |
| 14 | it('findFirstWikilinkToTargetInBody returns context', () => { |
| 15 | const ctx = findFirstWikilinkToTargetInBody('prefix [[My-Note]] suffix', wikilinkTargetKey('My-Note')); |
| 16 | assert.ok(ctx && ctx.includes('[[My-Note]]')); |
| 17 | }); |
| 18 | |
| 19 | it('findFirstWikilinkToTargetInBody returns null when no match', () => { |
| 20 | assert.equal(findFirstWikilinkToTargetInBody('no links', 'foo'), null); |
| 21 | }); |
| 22 | }); |
File History
1 commit
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d
docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge
Human
1 day ago