pediatric-ai-scribe-v3/test/clinical-retrieval-source-lock.test.js
Daniel 018913a845
All checks were successful
Forgejo Android APK / Build signed APK (push) Successful in 1m46s
Lock clinical assistant retrieval to configured source
2026-08-27 21:30:29 +02:00

13 lines
699 B
JavaScript

const test = require('node:test');
const assert = require('node:assert/strict');
const { filterSourcesByFilePath } = require('../src/utils/clinicalRetrieval');
test('source lock keeps only the selected book regardless of URL encoding', () => {
const path = 'Medical Library/Pediatrics/Kliegman R. Nelson Textbook of Pediatrics 2-Volume Set 22ed 2024.pdf';
const sources = [
{ title: 'Nelson', file_path: 'Medical Library/Pediatrics/Kliegman%20R.%20Nelson%20Textbook%20of%20Pediatrics%20%202-Volume%20Set%2022ed%202024.pdf' },
{ title: 'Other book', file_path: 'Medical Library/Pediatrics/Other.pdf' }
];
assert.deepEqual(filterSourcesByFilePath(sources, path), [sources[0]]);
});