test: cover public kaelio ktx package invocations

This commit is contained in:
Andrey Avtomonov 2026-05-11 11:25:24 +02:00
parent ba47ab95e7
commit 416e440e43
5 changed files with 167 additions and 750 deletions

View file

@ -32,7 +32,7 @@ describe('published package smoke config', () => {
assert.deepEqual(
readPublishedPackageSmokeConfig(
{
KTX_PUBLISHED_KTX_PACKAGE: '@ktx/cli-public',
KTX_PUBLISHED_KTX_PACKAGE: '@kaelio/ktx',
KTX_PUBLISHED_KTX_VERSION: 'latest',
KTX_PUBLISHED_KTX_REGISTRY: 'https://registry.npmjs.org/',
},
@ -42,7 +42,7 @@ describe('published package smoke config', () => {
enabled: true,
requireConfig: false,
configSource: 'environment',
packageName: '@ktx/cli-public',
packageName: '@kaelio/ktx',
packageVersion: 'latest',
registry: 'https://registry.npmjs.org/',
},
@ -55,7 +55,7 @@ describe('published package smoke config', () => {
{},
[],
{
packageName: '@ktx/cli-public',
packageName: '@kaelio/ktx',
version: '2026.5.8',
registry: 'https://registry.npmjs.org/',
},
@ -64,7 +64,7 @@ describe('published package smoke config', () => {
enabled: true,
requireConfig: false,
configSource: 'release-policy',
packageName: '@ktx/cli-public',
packageName: '@kaelio/ktx',
packageVersion: '2026.5.8',
registry: 'https://registry.npmjs.org/',
},
@ -75,12 +75,12 @@ describe('published package smoke config', () => {
assert.deepEqual(
readPublishedPackageSmokeConfig(
{
KTX_PUBLISHED_KTX_PACKAGE: '@ktx/cli-from-env',
KTX_PUBLISHED_KTX_PACKAGE: '@kaelio/ktx',
KTX_PUBLISHED_KTX_VERSION: 'latest',
},
[],
{
packageName: '@ktx/cli-from-policy',
packageName: '@kaelio/ktx',
version: '2026.5.8',
registry: 'https://registry.npmjs.org/',
},
@ -89,7 +89,7 @@ describe('published package smoke config', () => {
enabled: true,
requireConfig: false,
configSource: 'environment',
packageName: '@ktx/cli-from-env',
packageName: '@kaelio/ktx',
packageVersion: 'latest',
registry: 'https://registry.npmjs.org/',
},
@ -125,7 +125,7 @@ describe('published package smoke config', () => {
() =>
readPublishedPackageSmokeConfig(
{
KTX_PUBLISHED_KTX_PACKAGE: '@ktx/cli-public',
KTX_PUBLISHED_KTX_PACKAGE: '@kaelio/ktx',
KTX_PUBLISHED_KTX_VERSION: '--tag latest',
},
[],
@ -136,7 +136,7 @@ describe('published package smoke config', () => {
() =>
readPublishedPackageSmokeConfig(
{
KTX_PUBLISHED_KTX_PACKAGE: '@ktx/cli-public',
KTX_PUBLISHED_KTX_PACKAGE: '@kaelio/ktx',
KTX_PUBLISHED_KTX_REGISTRY: 'file:///tmp/npm',
},
[],
@ -150,38 +150,39 @@ describe('published package smoke command construction', () => {
const config = {
enabled: true,
requireConfig: false,
packageName: '@ktx/cli-public',
packageName: '@kaelio/ktx',
packageVersion: 'latest',
registry: 'https://registry.npmjs.org/',
};
it('builds the npx package spec from package name and version tag', () => {
assert.equal(publishedPackageSpec(config), '@ktx/cli-public@latest');
assert.equal(publishedPackageSpec(config), '@kaelio/ktx@latest');
});
it('builds npx commands with a registry env patch instead of shell interpolation', () => {
assert.deepEqual(buildPublishedPackageNpxCommand(config, ['--version']), {
label: 'published package command',
command: 'npx',
args: ['--yes', '@ktx/cli-public@latest', '--version'],
args: ['--yes', '@kaelio/ktx@latest', '--version'],
env: { npm_config_registry: 'https://registry.npmjs.org/' },
});
});
it('builds the full hybrid-search smoke command list', () => {
it('builds the full public package smoke command list', () => {
assert.deepEqual(buildPublishedPackageSmokeCommands(config, '/tmp/ktx-smoke/demo', '/tmp/ktx-smoke/empty'), [
{
label: 'published package version',
command: 'npx',
args: ['--yes', '@ktx/cli-public@latest', '--version'],
args: ['--yes', '@kaelio/ktx@latest', '--version'],
env: { npm_config_registry: 'https://registry.npmjs.org/' },
},
{
label: 'published package demo',
label: 'published package setup demo',
command: 'npx',
args: [
'--yes',
'@ktx/cli-public@latest',
'@kaelio/ktx@latest',
'setup',
'demo',
'--project-dir',
'/tmp/ktx-smoke/demo',
@ -191,55 +192,47 @@ describe('published package smoke command construction', () => {
env: { npm_config_registry: 'https://registry.npmjs.org/' },
},
{
label: 'published package wiki hybrid search',
label: 'published package sl query',
command: 'npx',
args: [
'--yes',
'@ktx/cli-public@latest',
'agent',
'wiki',
'search',
'ARR contract',
'--json',
'--limit',
'5',
'@kaelio/ktx@latest',
'sl',
'query',
'--project-dir',
'/tmp/ktx-smoke/demo',
'--connection-id',
'orbit_demo',
'--measure',
'contracts.contract_count',
'--format',
'sql',
'--yes',
],
env: { npm_config_registry: 'https://registry.npmjs.org/' },
},
{
label: 'published package semantic-layer hybrid search',
command: 'npx',
args: [
'--yes',
'@ktx/cli-public@latest',
'agent',
'sl',
'list',
'--json',
'--query',
'ARR',
'--project-dir',
'/tmp/ktx-smoke/demo',
],
label: 'published package local install',
command: 'pnpm',
args: ['add', '@kaelio/ktx@latest'],
env: { npm_config_registry: 'https://registry.npmjs.org/' },
},
{
label: 'published package missing-project readiness',
command: 'npx',
args: [
'--yes',
'@ktx/cli-public@latest',
'agent',
'sl',
'list',
'--json',
'--query',
'revenue',
'--project-dir',
'/tmp/ktx-smoke/empty',
],
label: 'published package local binary',
command: 'pnpm',
args: ['exec', 'ktx', '--version'],
env: { npm_config_registry: 'https://registry.npmjs.org/' },
},
{
label: 'published package global install',
command: 'pnpm',
args: ['add', '--global', '@kaelio/ktx@latest'],
env: { npm_config_registry: 'https://registry.npmjs.org/' },
},
{
label: 'published package global binary',
command: 'ktx',
args: ['--version'],
env: { npm_config_registry: 'https://registry.npmjs.org/' },
},
]);