26 lines
1.1 KiB
JavaScript
26 lines
1.1 KiB
JavaScript
import test from 'node:test'
|
||
import assert from 'node:assert/strict'
|
||
import { isKnownSitePath } from '../server/study-helpers.js'
|
||
|
||
test('real site pages are known paths', () => {
|
||
for (const p of ['/', '/study', '/study/titus/titus-abc', '/episodes/123', '/salvation', '/scripture', '/privacy']) {
|
||
assert.equal(isKnownSitePath(p), true, p)
|
||
}
|
||
})
|
||
|
||
test('scanner and probe paths are not known paths', () => {
|
||
for (const p of ['/.env', '/.git/config', '/wp-login', '/actuator/health', '/cgi-bin/x', '/random-path-123']) {
|
||
assert.equal(isKnownSitePath(p), false, p)
|
||
}
|
||
})
|
||
|
||
import { checkPassageReference } from '../shared/bible-books.js'
|
||
|
||
test('passage reference check accepts what the index can read and flags what it cannot', () => {
|
||
assert.equal(checkPassageReference('Titus 1:1-2', ''), null)
|
||
assert.equal(checkPassageReference('1:10–13a', 'titus'), null)
|
||
assert.match(checkPassageReference('1:1-2', ''), /Bible Book/)
|
||
assert.match(checkPassageReference('Foo 1:1', 'titus'), /not a recognized/)
|
||
assert.match(checkPassageReference('chapter one', 'titus'), /Use the form/)
|
||
})
|