Files
SnowLuma/packages/sqlite/tests/layout.test.ts
T
TanTan fa9c73363d
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run
SnowLuma v2.4.2 source snapshot
2026-11-13 09:02:00 +08:00

25 lines
1.3 KiB
TypeScript

import { expect, it } from 'vitest';
import { assertRuntime, prebuildFiles, runtimeLibc, runtimePrebuild } from '../src/layout';
it('selects only the exact platform, architecture and libc binary', () => {
expect(runtimePrebuild('win32', 'arm64')).toBe('win32-arm64/@appthreat+sqlite3.node');
expect(runtimePrebuild('darwin', 'x64')).toBe('darwin-x64/@appthreat+sqlite3.node');
expect(
runtimePrebuild('linux', 'arm64', runtimeLibc({ header: { glibcVersionRuntime: '2.39' } })),
).toBe('linux-arm64/@appthreat+sqlite3.glibc.node');
expect(runtimePrebuild('linux', 'x64', runtimeLibc({ header: {} }))).toBe(
'linux-x64/@appthreat+sqlite3.musl.node',
);
expect(() => runtimePrebuild('linux', 'x64')).toThrow('libc');
expect(() => prebuildFiles('linux-ia32')).toThrow('Unsupported SQLite target');
expect(() => runtimeLibc({})).toThrow('diagnostic report');
});
it('rejects incompatible runtimes before attempting to load a Node-API 10 binary', () => {
expect(() => assertRuntime('24.0.0', '10')).not.toThrow();
expect(() => assertRuntime('26.0.0', '11')).not.toThrow();
expect(() => assertRuntime('22.0.0', '10')).toThrow('Node >=24');
expect(() => assertRuntime('24.0.0', '9')).toThrow('Node-API >=10');
expect(() => assertRuntime('24.0.0', undefined)).toThrow('Node-API >=10');
});