1import '../common/index.mjs'; 2 3import assert from 'assert'; 4 5import { referenceToLocalMdFile } from '../../tools/doc/markdown.mjs'; 6 7{ 8 const shouldBeSpotted = [ 9 'test.md', 10 'TEST.MD', 11 'test.js.md', 12 '.test.md', 13 './test.md', 14 'subfolder/test.md', 15 '../test.md', 16 'test.md#anchor', 17 'subfolder/test.md#anchor', 18 '/test.md', 19 ]; 20 21 shouldBeSpotted.forEach((url) => { 22 assert.match(url, referenceToLocalMdFile); 23 }); 24} 25 26{ 27 const shouldNotBeSpotted = [ 28 'https://example.com/test.md', 29 'HTTPS://EXAMPLE.COM/TEST.MD', 30 'git+https://example.com/test.md', 31 'ftp://1.1.1.1/test.md', 32 'urn:isbn:9780307476463.md', 33 'file://./test.md', 34 '/dev/null', 35 'test.html', 36 'test.html#anchor.md', 37 'test.html?anchor.md', 38 'test.md5', 39 'testmd', 40 '.md', 41 ]; 42 43 shouldNotBeSpotted.forEach((url) => { 44 assert.doesNotMatch(url, referenceToLocalMdFile); 45 }); 46} 47