| 1 |
import { test } from "node:test"; |
| 2 |
import assert from "node:assert/strict"; |
| 3 |
import { operationLook } from "../out/looks.mjs"; |
| 4 |
|
| 5 |
test("operations read as what happened, with a kind and a colour", () => { |
| 6 |
const commit = operationLook('oxy commit -m "Backlog: rebase into the working copy overnight\\n\\nrefs #42"', false); |
| 7 |
assert.deepEqual(commit, { label: "Backlog: rebase into the working copy overnight", kind: "commit", icon: "git-commit", color: "oxygen.commit" }); |
| 8 |
assert.equal(operationLook("oxy push earth", false).label, "Pushed to earth"); |
| 9 |
assert.equal(operationLook("oxy push earth", false).color, "oxygen.push"); |
| 10 |
assert.equal(operationLook("oxy pull origin", false).label, "Pulled from origin"); |
| 11 |
assert.equal(operationLook("oxy bookmark switch feature/16-hud", false).label, "Switched to feature/16-hud"); |
| 12 |
assert.equal(operationLook("oxy bookmark create logo-25", false).label, "Bookmark logo-25 created"); |
| 13 |
assert.equal(operationLook("oxy merge develop", false).icon, "git-merge"); |
| 14 |
assert.equal(operationLook("oxy undo", false).color, "oxygen.undo"); |
| 15 |
assert.equal(operationLook("oxy status (snapshot)", true).kind, "snapshot"); |
| 16 |
assert.equal(operationLook('oxy commit -m "say \\"hi\\""', false).label, 'say "hi"'); |
| 17 |
// Anything else keeps its command, without the leading oxy. |
| 18 |
assert.equal(operationLook("oxy gc", false).label, "gc"); |
| 19 |
}); |