GitNexus/gitnexus/test/unit/vector-artifact-coverage.test.ts
Gergő Magyar 5dd58a5eec
chore(deps): consolidate updates and vendor compatible VECTOR (#3709)
* chore(deps): consolidate open Dependabot updates

Combine the lockfile updates from #3698, #3701, and #3702:
ip-address 10.7.4, zod 4.6.7, and js-yaml 5.5.0 with argparse 3.0.3.
Preserve each upstream package record and all unrelated dependency pins.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(lbug): vendor matching VECTOR extensions

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-24 14:42:43 +01:00

37 lines
1.5 KiB
TypeScript

import { createHash } from 'node:crypto';
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { describe, expect, it } from 'vitest';
import { resolveVendoredVectorPath } from '../../src/core/lbug/vendored-extension-path.js';
const vendorRoot = fileURLToPath(new URL('../../vendor/', import.meta.url));
const manifest = JSON.parse(
readFileSync(new URL('../../vendor/lbug-vector/manifest.json', import.meta.url), 'utf8'),
) as {
coreVersion: string;
artifacts: Array<{ tuple: string; sha256: string }>;
};
const pkg = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8')) as {
dependencies: Record<string, string>;
files: string[];
};
describe('packaged VECTOR artifacts', () => {
it('pins the artifacts to the installed core version and includes their provenance in npm', () => {
expect(manifest.coreVersion).toBe(pkg.dependencies['@ladybugdb/core']);
expect(pkg.files).toContain('vendor/lbug-vector/manifest.json');
expect(manifest.artifacts.map(({ tuple }) => tuple).sort()).toEqual([
'darwin-arm64',
'darwin-x64',
'linux-arm64',
'linux-x64',
'win32-x64',
]);
});
it.each(manifest.artifacts)('ships the verified $tuple binary', ({ tuple, sha256 }) => {
const artifact = resolveVendoredVectorPath({ vendorRoot, tuple });
if (artifact === null) throw new Error(`Missing packaged VECTOR artifact for ${tuple}`);
expect(createHash('sha256').update(readFileSync(artifact)).digest('hex')).toBe(sha256);
});
});