@velaro/cli 1.4.119 → 1.4.121

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.
Files changed (66) hide show
  1. package/README.md +0 -19
  2. package/bin/velaro.js +23 -92
  3. package/lib/avatar-motion.test.js +1 -1
  4. package/lib/avatar-switch.test.js +1 -1
  5. package/lib/commands/agent.js +7 -58
  6. package/lib/commands/ai-config.js +8 -34
  7. package/lib/commands/callpresence.js +143 -0
  8. package/lib/commands/index.js +18 -14
  9. package/lib/commands/kb.js +4 -94
  10. package/lib/commands/knowledge.js +2 -2
  11. package/lib/commands/ops-groups.js +0 -13
  12. package/lib/commands/safety.js +1 -1
  13. package/lib/commands/salesforce.js +1 -1
  14. package/lib/commands/sap.js +1 -1
  15. package/lib/commands/schedule-adherence.js +1 -1
  16. package/lib/commands/teams.js +1 -1
  17. package/lib/commands/woocommerce.js +1 -1
  18. package/lib/commands/workflow.js +4 -31
  19. package/lib/staff-optional.js +10 -0
  20. package/package.json +2 -2
  21. package/lib/cobrowse-settings.js +0 -90
  22. package/lib/cobrowse-settings.test.js +0 -45
  23. package/lib/commands/activity.js +0 -147
  24. package/lib/commands/acuity.js +0 -66
  25. package/lib/commands/ai-federation.js +0 -55
  26. package/lib/commands/ai-models.js +0 -203
  27. package/lib/commands/ai-spend.js +0 -71
  28. package/lib/commands/avatar.js +0 -253
  29. package/lib/commands/bigcommerce.js +0 -50
  30. package/lib/commands/calendly.js +0 -62
  31. package/lib/commands/cobrowse.js +0 -99
  32. package/lib/commands/coupon-grant.js +0 -192
  33. package/lib/commands/diag-groups.js +0 -108
  34. package/lib/commands/diagnostics.js +0 -298
  35. package/lib/commands/email-inbox.js +0 -110
  36. package/lib/commands/entitlement.js +0 -375
  37. package/lib/commands/image-analysis.js +0 -27
  38. package/lib/commands/logs-insights.js +0 -342
  39. package/lib/commands/logs.js +0 -1248
  40. package/lib/commands/migrate.js +0 -379
  41. package/lib/commands/migration-status.js +0 -66
  42. package/lib/commands/ops.js +0 -266
  43. package/lib/commands/parity-staff-tools.js +0 -205
  44. package/lib/commands/pricing.js +0 -132
  45. package/lib/commands/report-speed.js +0 -112
  46. package/lib/commands/scraper.js +0 -38
  47. package/lib/commands/site-provision.js +0 -68
  48. package/lib/commands/sitesync.js +0 -158
  49. package/lib/commands/skill-usage.js +0 -39
  50. package/lib/commands/staff.js +0 -31
  51. package/lib/commands/status-page.js +0 -95
  52. package/lib/commands/status-sla.js +0 -47
  53. package/lib/commands/subscription.js +0 -102
  54. package/lib/commands/support.js +0 -309
  55. package/lib/commands/tour-policy.js +0 -61
  56. package/lib/commands/triage.js +0 -66
  57. package/lib/entitlement-report-packages.test.js +0 -47
  58. package/lib/log-search.js +0 -252
  59. package/lib/log-search.test.js +0 -374
  60. package/lib/logs-insights.test.js +0 -146
  61. package/lib/messaging-routes.test.js +0 -37
  62. package/lib/report-speed.test.js +0 -26
  63. package/lib/siteUser.js +0 -35
  64. package/lib/siteUser.test.js +0 -45
  65. package/lib/skill-usage.test.js +0 -36
  66. package/lib/status-sla.test.js +0 -23
@@ -1,146 +0,0 @@
1
- import test from 'node:test';
2
- import assert from 'node:assert/strict';
3
- import {
4
- parseWindowMs, parseWhen, qs, commonParams, windowParams, parseExpiry, ptTime, trendText,
5
- sparkline, clean, formatGroups, formatRegression, formatTrace, formatAnomalies, formatSites,
6
- formatMutes, formatSensitive, logsInsightsCommand, INSIGHTS_BASE, INSIGHTS_META,
7
- scoped, anomalyLevel, CALL_TIMEOUT_MS, BRIEF_TIMEOUT_MS, MAX_WINDOW_MS,
8
- } from './commands/logs-insights.js';
9
-
10
- const NOW = new Date('2026-10-12T12:00:00Z');
11
- const strip = s => s.replace(/\x1b\[[0-9;]*m/g, '');
12
-
13
- test('parseWindowMs handles m/h/d, falls back only when missing, throws on junk', () => {
14
- assert.equal(parseWindowMs('30m'), 30 * 60_000);
15
- assert.equal(parseWindowMs('6h'), 6 * 3_600_000);
16
- assert.equal(parseWindowMs('2d'), 2 * 86_400_000);
17
- assert.equal(parseWindowMs(undefined, 7), 7);
18
- assert.equal(parseWindowMs('', 7), 7);
19
- assert.throws(() => parseWindowMs('6hrs'), /Invalid duration/);
20
- assert.throws(() => parseWindowMs('soon', 5), /Invalid duration/);
21
- });
22
-
23
- test('parseWhen: relative means "ago", ISO passes through, junk is null', () => {
24
- assert.equal(parseWhen('2h', NOW).toISOString(), '2026-10-12T10:00:00.000Z');
25
- assert.equal(parseWhen('2026-10-12T09:00:00Z', NOW).toISOString(), '2026-10-12T09:00:00.000Z');
26
- assert.equal(parseWhen('banana', NOW), null);
27
- assert.equal(parseWhen('', NOW), null);
28
- });
29
-
30
- test('parseExpiry: never/undefined -> undefined, duration is from now, junk throws', () => {
31
- assert.equal(parseExpiry('never', NOW), undefined);
32
- assert.equal(parseExpiry(undefined, NOW), undefined);
33
- assert.equal(parseExpiry('7d', NOW), '2026-10-19T12:00:00.000Z');
34
- assert.equal(parseExpiry('2026-12-01T00:00:00Z', NOW), '2026-12-01T00:00:00.000Z');
35
- assert.throws(() => parseExpiry('someday', NOW), /--expires/);
36
- });
37
-
38
- test('qs skips empties and encodes', () => {
39
- assert.equal(qs({ a: 'x y', b: '', c: undefined, d: 0, e: null }), '?a=x+y&d=0');
40
- assert.equal(qs({}), '');
41
- });
42
-
43
- test('commonParams uppercases level and maps --site to siteId', () => {
44
- assert.deepEqual(commonParams({ level: 'error', platform: 'v20', environment: 'Staging', site: 5 }),
45
- { level: 'ERROR', platform: 'v20', environment: 'Staging', siteId: 5 });
46
- });
47
-
48
- test('windowParams spans --last ending now', () => {
49
- const w = windowParams({ last: '6h' }, '24h', NOW);
50
- assert.equal(w.from, '2026-10-12T06:00:00.000Z');
51
- assert.equal(w.to, '2026-10-12T12:00:00.000Z');
52
- assert.equal(windowParams({}, '24h', NOW).from, '2026-10-11T12:00:00.000Z');
53
- });
54
-
55
- test('routes target the messaging insights base', () => {
56
- assert.equal(INSIGHTS_BASE, 'superadmin/logs/insights');
57
- assert.equal(INSIGHTS_META, 'superadmin/logs/meta/insights');
58
- });
59
-
60
- test('trendText uses words, handles null', () => {
61
- assert.equal(trendText(25), 'up 25%');
62
- assert.equal(trendText(-12.34), 'down 12.3%');
63
- assert.equal(trendText(0.3), 'flat');
64
- assert.equal(trendText(null), 'n/a');
65
- });
66
-
67
- test('sparkline scales and tolerates empty / zeros', () => {
68
- assert.equal(sparkline([]), '');
69
- assert.equal(sparkline([0, 0]).length, 2);
70
- const s = sparkline([0, 10]);
71
- assert.equal(s[0], '▁');
72
- assert.equal(s[1], '█');
73
- });
74
-
75
- test('clean strips control characters (terminal injection)', () => {
76
- assert.equal(clean('a\x1b[31mb\x07c'), 'a[31mbc');
77
- });
78
-
79
- test('ptTime renders Pacific', () => {
80
- assert.match(ptTime('2026-10-12T20:00:00Z'), /1:00.*PT$/);
81
- assert.equal(ptTime(null), '-');
82
- });
83
-
84
- test('formatGroups shows servedFrom, truncation, new/muted flags and never emits raw escapes from messages', () => {
85
- const out = strip(formatGroups({
86
- servedFrom: 'Staging', truncated: true, scanned: 100,
87
- groups: [{ fingerprint: 'fp', sampleMessage: 'boom \x1b[2J gone', logger: 'A.B', count: 3, sparkline: [1, 2, 3], isNew: true, muted: false, sitesCount: 2, firstSeen: '2026-10-12T10:00:00Z', lastSeen: '2026-10-12T11:00:00Z' }],
88
- }));
89
- assert.match(out, /Showing Staging logs/);
90
- assert.match(out, /Results capped after scanning 100/);
91
- assert.match(out, /\[new\]/);
92
- assert.doesNotMatch(out, /\x1b/);
93
- assert.equal(strip(formatGroups({ groups: [] })), 'No error groups.');
94
- });
95
-
96
- test('other formatters render and survive empty responses', () => {
97
- assert.match(strip(formatRegression({ before: { total: 5, errors: 1 }, after: { total: 9, errors: 4 }, newGroups: [], increased: [{ before: 1, after: 5, ratio: 5, sampleMessage: 'x' }, { before: 0, after: 2, ratio: null, sampleMessage: 'y' }], gone: [] })), /from zero/);
98
- assert.match(strip(formatTrace({ events: [{ deltaMs: 12, lane: 'v20', level: 'ERROR', message: 'bad' }], platformsSeen: ['v20'], durationMs: 12, errorCount: 1 })), /\+ {4}12ms v20 +ERROR bad/);
99
- assert.match(strip(formatAnomalies({ buckets: [{ hourUtc: '2026-10-12T20:00:00Z', count: 9, z: 7, isAnomaly: true, lowConfidence: true }], anomalies: [{}] })), /ANOMALY z=7.0.*low confidence/);
100
- assert.equal(formatAnomalies({ buckets: [] }), 'No hourly data.');
101
- assert.match(strip(formatSites({ sites: [{ siteId: 9, total: 10, errors: 5, errorRate: 0.5, trendPct: 20, topGroups: [{ count: 2, sampleMessage: 'm' }] }], unattributed: 4 })), /50\.0%.*up 20%[\s\S]*4 events had no site id/);
102
- assert.equal(formatSites({ sites: [] }), 'No site-attributed events.');
103
- assert.match(strip(formatMutes({ mutes: [{ fingerprint: 'f', reason: 'r', expiresAt: null }] })), /never expires/);
104
- assert.equal(formatMutes({ mutes: [] }), 'No active mutes.');
105
- assert.match(strip(formatSensitive({ findings: [{ type: 'email', count: 2, sampleRedacted: '[REDACTED:email]', logger: 'L' }], truncated: true })), /email[\s\S]*Results capped/);
106
- });
107
-
108
- test('command tree exposes every insights subcommand', () => {
109
- const seen = [];
110
- const fake = { command(c) { seen.push(c.command.split(' ')[0]); return fake; }, demandCommand() { return fake; } };
111
- logsInsightsCommand.builder(fake);
112
- assert.deepEqual(seen, ['groups', 'new', 'regression', 'trace', 'anomalies', 'sites', 'mutes', 'mute', 'unmute', 'sensitive', 'brief']);
113
- });
114
-
115
- test('scoped drops the filters an endpoint does not accept', () => {
116
- const argv = { level: 'warn', platform: 'v10', environment: 'Staging', site: 9 };
117
- assert.deepEqual(scoped(argv), { level: 'WARN', platform: 'v10', environment: 'Staging', siteId: 9 });
118
- assert.equal(scoped(argv, { site: false }).siteId, undefined);
119
- const r = scoped(argv, { site: false, level: false });
120
- assert.equal('siteId' in r, false);
121
- assert.equal('level' in r, false);
122
- assert.equal(r.environment, 'Staging');
123
- });
124
-
125
- test('anomalyLevel allows only ERROR or WARN', () => {
126
- assert.equal(anomalyLevel(undefined), 'ERROR');
127
- assert.equal(anomalyLevel('warn'), 'WARN');
128
- assert.throws(() => anomalyLevel('info'), /ERROR or WARN/);
129
- });
130
-
131
- test('timeouts and window cap constants', () => {
132
- assert.equal(CALL_TIMEOUT_MS, 90_000);
133
- assert.equal(BRIEF_TIMEOUT_MS, 120_000);
134
- assert.equal(MAX_WINDOW_MS, 24 * 3_600_000);
135
- });
136
-
137
- test('help text no longer advertises a 7d window for from/to commands', () => {
138
- const opts = {};
139
- const y = { option(k, o) { opts[k] = o; return y; }, positional() { return y; }, command() { return y; }, demandCommand() { return y; } };
140
- const tree = [];
141
- logsInsightsCommand.builder({ command(c) { tree.push(c); return this; }, demandCommand() { return this; } });
142
- const groups = tree.find(c => c.command === 'groups');
143
- groups.builder(y);
144
- assert.doesNotMatch(opts.last.describe, /7d/);
145
- assert.match(opts.last.describe, /24h/);
146
- });
@@ -1,37 +0,0 @@
1
- // Regression (2026-10-11): `velaro team list` / `deployment list` / `rule list` / `agent list` etc.
2
- // 404'd on every environment because they called the ADMIN api for routes that only exist on the
3
- // MESSAGING api. Admin has no controller for these prefixes; any command using admin get/post/del
4
- // (or request()) for one of them is broken.
5
- import test from 'node:test';
6
- import assert from 'node:assert/strict';
7
- import fs from 'node:fs';
8
- import path from 'node:path';
9
- import { fileURLToPath } from 'node:url';
10
-
11
- const dir = path.join(path.dirname(fileURLToPath(import.meta.url)), 'commands');
12
- const MESSAGING_ONLY = ['/Teams/List', '/Deployment', '/Users/List', '/Workflows/List', '/Rules', '/Ticket/knowledge-overrides', '/UserStatus/admin', '/api/ivr/config', '/WooCommerce/billing', '/WooCommerce/auth', '/diagnostics/test-magento', '/voice/admin', '/api/enterprise-reports', '/avatar/groups', '/avatar/workflows', '/avatar/group-overrides', '/Recruiting', '/superadmin/logs/insights', '/ApplePayPresetOrders', '/ApplePayConfig'];
13
-
14
- test('messaging-only routes are never called through the admin api helpers', () => {
15
- const offenders = [];
16
- for (const f of fs.readdirSync(dir).filter(n => n.endsWith('.js'))) {
17
- const src = fs.readFileSync(path.join(dir, f), 'utf8');
18
- // `get`/`post`/`del` imported unaliased from api.js are the ADMIN helpers.
19
- const imp = /import\s*\{([^}]*)\}\s*from\s*'\.\.\/api\.js'/.exec(src);
20
- const specifiers = imp ? imp[1].split(',').map(s => s.trim()) : [];
21
- const importsAdminHelpers = specifiers.some(s => ['get', 'post', 'del'].includes(s));
22
- for (const route of MESSAGING_ONLY) {
23
- const admin = new RegExp(String.raw`(?<![A-Za-z])(${importsAdminHelpers ? 'get|post|del|' : ''}request\('(?:GET|POST|PUT|DELETE)',)\s*\(?\s*['"\`]${route.replace(/[/.]/g, '\\$&')}`);
24
- if (admin.test(src)) offenders.push(`${f}: ${route}`);
25
- }
26
- }
27
- assert.deepEqual(offenders, [], `messaging-only routes called via the admin api:\n${offenders.join('\n')}`);
28
- });
29
-
30
- // The logger-insights routes (superadmin/logs/insights/*, meta/insights) exist only on the messaging
31
- // api. logs-insights.js must reach them through messagingRequest and never the admin helpers.
32
- test('logs-insights.js uses the messaging helper only', () => {
33
- const src = fs.readFileSync(path.join(dir, 'logs-insights.js'), 'utf8');
34
- assert.match(src, /messagingRequest/);
35
- assert.doesNotMatch(src, /import\s*\{[^}]*\b(get|post|del)\b[^}]*\}\s*from '\.\.\/api\.js'/);
36
- assert.match(src, /superadmin\/logs\/insights/);
37
- });
@@ -1,26 +0,0 @@
1
- // velaro report-speed output formatting (global view and one customer's inherited / overridden level).
2
- import test from 'node:test';
3
- import assert from 'node:assert/strict';
4
- import { formatReportSpeed } from './commands/report-speed.js';
5
-
6
- const levels = ['economy', 'standard', 'fast', 'unlimited'].map(key => ({ key }));
7
- const standard = { name: 'Standard', maxConcurrentJobs: 2, ruPerSecond: 400, burstSeconds: 5, pageSize: 500, interPageDelayMs: 50 };
8
-
9
- test('shows an inherited customer level', () => {
10
- const out = formatReportSpeed({ siteId: 1234, effective: standard, inherited: true, source: 'GlobalDefault', globalDefault: 'standard', levels });
11
- assert.match(out, /Site 1234/);
12
- assert.match(out, /inherited \(GlobalDefault\)/);
13
- assert.match(out, /400 RU\/s/);
14
- });
15
-
16
- test('shows an override and who set it', () => {
17
- const out = formatReportSpeed({ siteId: 1234, effective: { ...standard, name: 'Economy', ruPerSecond: 100 }, inherited: false, overrideBy: 'alex@velaro.com', globalDefault: 'standard', levels });
18
- assert.match(out, /overridden by alex@velaro.com/);
19
- });
20
-
21
- test('unpaced level says so, global view says global default', () => {
22
- const out = formatReportSpeed({ siteId: 0, effective: { ...standard, name: 'Unlimited (internal)', ruPerSecond: 0 }, inherited: true, globalDefault: 'standard', levels });
23
- assert.match(out, /not paced/);
24
- assert.match(out, /Global/);
25
- assert.match(out, /global default/);
26
- });
package/lib/siteUser.js DELETED
@@ -1,35 +0,0 @@
1
- // Ensure a NORMAL (agent|administrator) user with an explicit, non-forcing password on any customer site.
2
- // Composes velaro-messaging's existing staff SuperAdmin endpoints (no new backend):
3
- // GET SuperAdmin/users/{siteId} (find by email)
4
- // POST SuperAdmin/users/{siteId} (create WorkspaceUser + Entra, SendEmail=false)
5
- // POST SuperAdmin/users/{siteId}/{userId}/set-password (non-forcing, audit-logged server side)
6
- // The password is only ever sent in the HTTPS body of set-password; never logged or returned.
7
- const ROLE_MAP = { agent: 'Agent', administrator: 'Administrator' };
8
-
9
- export async function ensureSiteUser({ get, post }, args) {
10
- const role = String(args.role || 'agent').toLowerCase();
11
- if (!ROLE_MAP[role]) throw new Error('role must be agent or administrator (staff/superadmin roles are never granted here).');
12
- const siteId = Number(args.siteId);
13
- if (!Number.isInteger(siteId) || siteId <= 0) throw new Error('siteId must be a positive integer.');
14
- const email = String(args.email || '').trim().toLowerCase();
15
- if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) throw new Error('A valid email is required.');
16
- if (typeof args.password !== 'string' || args.password.length < 8) throw new Error('password is required (min 8 characters).');
17
-
18
- const listed = await get(`SuperAdmin/users/${siteId}`);
19
- const users = Array.isArray(listed) ? listed : (listed?.users || []);
20
- let user = users.find(u => String(u.email || u.Email || '').toLowerCase() === email);
21
- let created = false;
22
- if (!user) {
23
- const res = await post(`SuperAdmin/users/${siteId}`, {
24
- email, firstName: args.firstName || '', lastName: args.lastName || '',
25
- roles: [ROLE_MAP[role]], sendEmail: false,
26
- });
27
- if (!res?.success) throw new Error(`Create failed: ${res?.error || res?.message || 'unknown error'}`);
28
- user = { id: res.user.id ?? res.user.Id, roles: res.user.roles };
29
- created = true;
30
- }
31
- const userId = user.id ?? user.Id;
32
- const sp = await post(`SuperAdmin/users/${siteId}/${userId}/set-password`, { newPassword: args.password });
33
- if (sp && sp.success === false) throw new Error(`set-password failed: ${sp.error || 'unknown error'}`);
34
- return { success: true, siteId, userId, email, created, roles: user.roles || [ROLE_MAP[role]], passwordSet: true };
35
- }
@@ -1,45 +0,0 @@
1
- import test from 'node:test';
2
- import assert from 'node:assert/strict';
3
- import { ensureSiteUser } from './siteUser.js';
4
-
5
- const base = { siteId: 100160, email: 'R@Velaro.com', password: 'S3cretPassw0rd!', role: 'agent' };
6
- function fakes(existing) {
7
- const calls = [];
8
- return {
9
- calls,
10
- get: async (p) => { calls.push(['GET', p]); return existing ? [{ id: 7, email: 'r@velaro.com', roles: ['Agent'] }] : []; },
11
- post: async (p, b) => { calls.push(['POST', p, b]); return p.endsWith('set-password') ? { success: true } : { success: true, user: { id: 9, roles: ['Agent'] } }; },
12
- };
13
- }
14
-
15
- test('creates user then sets password, never returns the password', async () => {
16
- const f = fakes(false);
17
- const r = await ensureSiteUser(f, base);
18
- assert.equal(r.created, true);
19
- assert.equal(r.userId, 9);
20
- assert.ok(!JSON.stringify(r).includes(base.password));
21
- assert.equal(f.calls[1][2].sendEmail, false);
22
- assert.deepEqual(f.calls[1][2].roles, ['Agent']);
23
- });
24
-
25
- test('idempotent: existing user only gets password reset', async () => {
26
- const f = fakes(true);
27
- const r = await ensureSiteUser(f, base);
28
- assert.equal(r.created, false);
29
- assert.equal(f.calls.filter(c => c[0] === 'POST').length, 1);
30
- assert.ok(f.calls[1][1].endsWith('/7/set-password'));
31
- });
32
-
33
- test('rejects superadmin/staff roles and weak input', async () => {
34
- const f = fakes(false);
35
- for (const role of ['superadmin', 'Velaro Admin', 'support']) await assert.rejects(ensureSiteUser(f, { ...base, role }));
36
- await assert.rejects(ensureSiteUser(f, { ...base, password: 'short' }));
37
- await assert.rejects(ensureSiteUser(f, { ...base, email: 'nope' }));
38
- assert.equal(f.calls.length, 0);
39
- });
40
-
41
- test('errors never contain the password', async () => {
42
- const f = fakes(true);
43
- f.post = async () => ({ success: false, error: 'boom' });
44
- await assert.rejects(ensureSiteUser(f, base), e => !e.message.includes(base.password));
45
- });
@@ -1,36 +0,0 @@
1
- import { test } from 'node:test';
2
- import assert from 'node:assert/strict';
3
- import { formatSkillUsage } from './commands/skill-usage.js';
4
-
5
- const sample = {
6
- siteId: 1032,
7
- month: '2026-10',
8
- isTrial: true,
9
- overageBehavior: 'block',
10
- usage: [
11
- { metric: 'ai_tool_calls', name: 'AI Tool Calls', used: 120, limit: 500, unlimited: false, percent: 24, mode: 'Enforce' },
12
- { metric: 'api_calls', name: 'REST API Calls', used: 9, limit: 0, unlimited: true, percent: 0, mode: 'Observe' },
13
- ],
14
- callsBySurface: [{ surface: 'McpStaff', calls: 4 }],
15
- llmCostThisMonth: [{ keySource: 'byok', costUsd: 1.5, calls: 3 }],
16
- };
17
-
18
- test('shows usage against the limit with the gate mode, and marks unlimited metrics', () => {
19
- const out = formatSkillUsage(sample);
20
- assert.match(out, /Site 1032, 2026-10 \(trial\), overage: block/);
21
- assert.match(out, /AI Tool Calls\s+120 \/\s+500\s+24%\s+gate: Enforce/);
22
- assert.match(out, /REST API Calls\s+9 \/\s+unlimited/);
23
- });
24
-
25
- test('lists calls by surface and the LLM cost split, saying BYOK removes LLM cost only', () => {
26
- const out = formatSkillUsage(sample);
27
- assert.match(out, /McpStaff\s+4/);
28
- assert.match(out, /byok\s+\$1\.50 \/ 3 calls/);
29
- assert.match(out, /BYOK removes this cost only/);
30
- });
31
-
32
- test('handles a site with no recorded usage without throwing', () => {
33
- const out = formatSkillUsage({ siteId: 5, month: '2026-10', overageBehavior: 'warn' });
34
- assert.match(out, /\(none recorded\)/);
35
- assert.match(out, /\(none logged\)/);
36
- });
@@ -1,23 +0,0 @@
1
- import { test } from 'node:test';
2
- import assert from 'node:assert/strict';
3
- import { buildStatusSlaQuery } from './commands/status-sla.js';
4
-
5
- test('status-sla query maps flags to endpoint params', () => {
6
- const q = new URLSearchParams(buildStatusSlaQuery({
7
- from: '2026-09-01', to: '2026-09-30', platform: 'v11', includeMaintenance: true,
8
- degradedDown: true, slowMs: 1500, csv: true,
9
- }));
10
- assert.equal(q.get('from'), '2026-09-01');
11
- assert.equal(q.get('platform'), 'v11');
12
- assert.equal(q.get('includeMaintenance'), 'true');
13
- assert.equal(q.get('degradedCountsAsDown'), 'true');
14
- assert.equal(q.get('slowResponseMs'), '1500');
15
- assert.equal(q.get('format'), 'csv');
16
- assert.equal(q.get('includeDeployments'), null);
17
- });
18
-
19
- test('status-sla query defaults to v20 json', () => {
20
- const q = new URLSearchParams(buildStatusSlaQuery({ from: 'a', to: 'b' }));
21
- assert.equal(q.get('platform'), 'v20');
22
- assert.equal(q.get('format'), 'json');
23
- });