Files
ai-coding-skills/skills/atlassian/shared/scripts/tests/command-helpers.test.ts
T
stefano 251148c3ff
check / check (ubuntu-latest) (push) Successful in 2m5s
check / check (macos-latest) (push) Has been cancelled
check-online / check-online (ubuntu-latest) (push) Successful in 1m53s
Perform code optimization and document cleanup (#1)
## Summary
- add repository-wide quality tooling and verification scaffolding, including CI workflows, pnpm workspace setup, ESLint/Prettier/markdown checks, and generated-output verification helpers
- reorganize skill sources and generation flow by introducing canonical `_source` variants, generator/manifests, reusable helper abstractions, and shared web-automation/browser utilities
- clean up and expand documentation so the root README flows into docs and skill docs, with clearer development, reviewer, installer, and workflow guidance

## Notable changes
- docs flow and consistency cleanup across `README.md`, `docs/README.md`, and related docs
- new scripts for `check`, docs verification, generated-file verification, shell portability, and safe directory replacement
- refactors in Atlassian and web-automation skill runtimes to reduce duplication and centralize reusable code
- changelog, development documentation, and CI surface updates

## Test Plan
- [ ] `pnpm run check`
- [ ] review generated/manifests and skill sync outputs
- [ ] smoke-check docs flow from `README.md` to `docs/README.md` to skill docs

## Notes
- this branch currently includes tracked `skills/web-automation/shared/node_modules` content that should be reviewed carefully as potentially noisy/accidental committed artifacts

Co-authored-by: Stefano Fiorini <stefano.fiorini@firsthorizon.com>
Reviewed-on: #1
2026-05-04 04:41:34 +00:00

44 lines
1.7 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import { dryRunResponse, resolveFormat } from "../src/command-helpers.js";
// ── dryRunResponse ────────────────────────────────────────────────────────
test("dryRunResponse wraps data with ok:true and dryRun:true", () => {
const data = { method: "POST", url: "https://example.com/api/v2/pages" };
const result = dryRunResponse(data);
assert.equal(result.ok, true);
assert.equal(result.dryRun, true);
assert.deepEqual(result.data, data);
});
test("dryRunResponse preserves the exact data reference", () => {
const data = { nested: { key: "value" } };
const result = dryRunResponse(data);
assert.strictEqual(result.data, data);
});
test("dryRunResponse works with primitive data", () => {
const result = dryRunResponse("dry-run-string");
assert.equal(result.ok, true);
assert.equal(result.dryRun, true);
assert.equal(result.data, "dry-run-string");
});
// ── resolveFormat ─────────────────────────────────────────────────────────
test("resolveFormat returns json by default for undefined", () => {
assert.equal(resolveFormat(undefined), "json");
});
test("resolveFormat returns json for unrecognised values", () => {
assert.equal(resolveFormat("xml"), "json");
assert.equal(resolveFormat(""), "json");
assert.equal(resolveFormat("TEXT"), "json");
});
test("resolveFormat returns text only for the exact string 'text'", () => {
assert.equal(resolveFormat("text"), "text");
});