36 lines
1.5 KiB
JavaScript
36 lines
1.5 KiB
JavaScript
const { test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
|
|
const root = path.join(__dirname, '..');
|
|
|
|
function read(relativePath) {
|
|
return fs.readFileSync(path.join(root, relativePath), 'utf8');
|
|
}
|
|
|
|
test('AI memory context is limited to saved template categories', () => {
|
|
const route = read('src/routes/memories.js');
|
|
assert.match(route, /var AI_CONTEXT_CATEGORIES = \[/);
|
|
assert.match(route, /'physical_exam'/);
|
|
assert.match(route, /'template_ed'/);
|
|
assert.match(route, /rows = rows\.filter\(function\(r\) \{ return AI_CONTEXT_CATEGORIES\.indexOf\(r\.category\) !== -1; \}\)/);
|
|
assert.doesNotMatch(route.match(/var AI_CONTEXT_CATEGORIES = \[[\s\S]*?\];/)[0], /'custom'/);
|
|
});
|
|
|
|
test('browser Whisper is removed from public runtime and user settings', () => {
|
|
assert.equal(fs.existsSync(path.join(root, 'public/js/browserWhisper.js')), false);
|
|
const publicRuntimeFiles = [
|
|
'public/index.html',
|
|
'public/js/app.js',
|
|
'public/components/settings.html',
|
|
'public/components/faq.html'
|
|
];
|
|
publicRuntimeFiles.forEach((file) => {
|
|
assert.doesNotMatch(read(file), /BrowserWhisper|browser-whisper|Browser Whisper|Xenova\/whisper|transformers\.min\.js/, file);
|
|
});
|
|
const dockerfile = read('Dockerfile');
|
|
assert.doesNotMatch(dockerfile, /Xenova\/whisper|transformers\.min\.js|Browser Whisper/);
|
|
const server = read('server.js');
|
|
assert.doesNotMatch(server, /wasm-unsafe-eval|unsafe-eval|huggingface\.co|cdn-lfs|transformers/);
|
|
});
|