badgr-cli 1.0.38 → 1.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -1
- package/package.json +12 -8
- package/src/badgr.js +8 -0
- package/src/catalog.js +193 -1
- package/src/commands/comfyui.js +1 -1
- package/src/commands/receipts.js +2 -1
- package/src/commands/run.js +111 -25
- package/src/commands/test-run.js +4 -4
- package/src/commands/workload.js +197 -0
- package/src/commands/workspace.js +136 -0
- package/tests/commands.test.js +48 -0
- package/tests/run-lifecycle.test.js +55 -18
- package/tests/template.test.js +6 -4
- package/tests/workload-rerun.test.js +56 -0
- package/tests/workload-templates.test.js +1 -1
- package/tests/workload-workspace-paths.test.js +46 -0
|
@@ -239,7 +239,7 @@ describe('comfyuiCommand', () => {
|
|
|
239
239
|
const bodyBuilder = fallback.callWithFallback.mock.calls[0][2];
|
|
240
240
|
const body = bodyBuilder();
|
|
241
241
|
expect(body.env.COMFYUI_WORKFLOW_B64).toBe(Buffer.from(wfContent).toString('base64'));
|
|
242
|
-
expect(body.image).toBe('yanwk/comfyui-boot:
|
|
242
|
+
expect(body.image).toBe('yanwk/comfyui-boot:cu126-megapak');
|
|
243
243
|
});
|
|
244
244
|
|
|
245
245
|
it('skips health check when --no-wait', async () => {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
|
|
3
|
+
// Capture every path passed to callApi so we can assert the CLI never builds a
|
|
4
|
+
// doubled `/v1/v1/...` URL. baseUrl already ends in `/v1`, so command paths must
|
|
5
|
+
// be unprefixed (e.g. `/workspaces`, not `/v1/workspaces`).
|
|
6
|
+
const calls = [];
|
|
7
|
+
vi.mock('../src/api.js', () => ({
|
|
8
|
+
callApi: vi.fn(async (path) => {
|
|
9
|
+
calls.push(path);
|
|
10
|
+
if (path.startsWith('/workspaces')) return { workspaces: [], total: 0 };
|
|
11
|
+
if (path.startsWith('/workloads')) return { workloads: [], total: 0 };
|
|
12
|
+
return {};
|
|
13
|
+
}),
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
const { workspaceCommand } = await import('../src/commands/workspace.js');
|
|
17
|
+
const { workloadCommand } = await import('../src/commands/workload.js');
|
|
18
|
+
|
|
19
|
+
// chalk stub: any style method returns its first argument unchanged.
|
|
20
|
+
const chalk = new Proxy({}, { get: () => (s) => s });
|
|
21
|
+
const config = { apiKey: 'test-key', baseUrl: 'https://aibadgr.com/v1' };
|
|
22
|
+
|
|
23
|
+
function assertNoDoubleV1() {
|
|
24
|
+
expect(calls.length).toBeGreaterThan(0);
|
|
25
|
+
for (const path of calls) {
|
|
26
|
+
expect(path.startsWith('/v1/')).toBe(false);
|
|
27
|
+
expect(`${config.baseUrl}${path}`).not.toContain('/v1/v1/');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
calls.length = 0;
|
|
33
|
+
vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('CLI workload/workspace request paths', () => {
|
|
37
|
+
it('workspace list targets /workspaces (no doubled /v1)', async () => {
|
|
38
|
+
await workspaceCommand(config, ['list'], chalk);
|
|
39
|
+
assertNoDoubleV1();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('workload list targets /workloads (no doubled /v1)', async () => {
|
|
43
|
+
await workloadCommand(config, ['list'], chalk);
|
|
44
|
+
assertNoDoubleV1();
|
|
45
|
+
});
|
|
46
|
+
});
|