16 lines
765 B
JavaScript
16 lines
765 B
JavaScript
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
|
|
test('ONNX Runtime receives an absolute same-origin base URL', async () => {
|
|
const {createOnnxWasmPaths} = await import('../piper-onnx-config.mjs');
|
|
const wasmPaths = createOnnxWasmPaths('https://ai-spel.k3s.k0.nu');
|
|
assert.equal(wasmPaths, 'https://ai-spel.k3s.k0.nu/tts/piper-wasm-v1/onnx/');
|
|
assert.equal(new URL('ort-wasm-simd-threaded.mjs', wasmPaths).href,
|
|
'https://ai-spel.k3s.k0.nu/tts/piper-wasm-v1/onnx/ort-wasm-simd-threaded.mjs');
|
|
});
|
|
|
|
test('ONNX Runtime base URL rejects an invalid worker origin', async () => {
|
|
const {createOnnxWasmPaths} = await import('../piper-onnx-config.mjs');
|
|
assert.throws(() => createOnnxWasmPaths('undefined'), TypeError);
|
|
});
|