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]]); });