import assert from "node:assert/strict"
import { describe, it } from "node:test"
import {
  clampIndentLevel,
  DOCS_MAX_INDENT_LEVEL,
  indentLevelToMarginPx,
  nextIndentLevel,
} from "./docs-indent.ts"

describe("docs-indent", () => {
  it("clamps indent levels", () => {
    assert.equal(clampIndentLevel(-2), 0)
    assert.equal(clampIndentLevel(0), 0)
    assert.equal(clampIndentLevel(DOCS_MAX_INDENT_LEVEL + 3), DOCS_MAX_INDENT_LEVEL)
  })

  it("steps indent by one level", () => {
    assert.equal(nextIndentLevel(1, 1), 2)
    assert.equal(nextIndentLevel(0, -1), 0)
  })

  it("maps level to margin px", () => {
    assert.equal(indentLevelToMarginPx(2), 72)
  })
})
