# Tests — create-print-layout skill

## Test 1: Skill activation

**Input:** "Create a print layout for the Order module that produces a PDF invoice"

**Expected behavior:**

-   Skill activates (description matches trigger phrases "print layout for X", "PDF invoice")
-   Skill checks whether `BoOrder` exists before proceeding
-   Output begins with: what file will be created, which template will be used, what Declarations
    are needed

**Pass criteria:** Skill is selected (not `create-process` or `create-ui-page`). Does not
activate for "create a process" or "add a UI screen".

---

## Test 2: Standard PDF creation

**Input:** "Create a standard PDF print layout for Order called `OrderSummaryPDF` in the Order
module. It should show company logo, delivery address, a line items table, and a total."

**Expected output:**

-   File: `src/Order/PL/OrderSummaryPDF/OrderSummaryPDF.printlayoutv2.xml`
-   Root: `<PrintLayout xmlns="https://www.salesforce.com/cgcloud/xsds" ... name="OrderSummaryPDF">`
-   Declarations: `BoOrder`, at minimum `LuSalesOrg` or similar, and `Image`
-   `<ReportLayout pageMargins="[40,40,40,40]">`
-   At least one `<table>` with `<thead>` and a `<each>` in `<tbody>`
-   `{{Labels::...}}` macros all include `defaultLabel=`
-   `{{Declarations::...}}` macros reference only declared names

**Pass criteria:** Build passes (`sf mdl build`). Print preview renders in simulate with no
literal `{{...}}` text visible.

---

## Test 3: Thermal receipt creation

**Input:** "Create a thermal receipt print layout for the Order module called `VanSalesReceipt`."

**Expected output:**

-   File: `src/Order/PL/VanSalesReceipt/VanSalesReceipt.printlayoutv2.xml`
-   Root: `<PrintLayout ... name="VanSalesReceipt">`
-   `<ReportLayout>` with **no** `pageMargins` attribute
-   No `<header>`, `<footer>`, or `<pageNumber/>` elements
-   Uses `<lineFeed/>` and/or `<rule/>` for spacing
-   Column widths in `<thead>` are percentages summing to 100%
-   No `<img>` inside any `<td>`

**Pass criteria:** Build passes. Layout note in output or comment states this is derived from
`ai-wiki/wiki/print-layouts.md` (no real thermal file exists in the codebase).

---

## Test 4: Missing Declaration catch

**Input:** "Create a print layout that references `{{Declarations::missingBo.field}}`
but does not add a `<DataDeclaration name='missingBo'>` to the Declarations block."

**Expected behavior:**

-   Skill identifies that `missingBo` is not declared
-   Either adds the missing DataDeclaration automatically, or flags the error with the fix
    (add `<DataDeclaration name="missingBo" type="<BoBo>" />` to `<Declarations>`)
-   Does NOT produce a file with an unresolvable macro reference

**Pass criteria:** The generated file has a DataDeclaration for every variable used in any
`{{Declarations::...}}` macro. No orphaned macro references.

---

## Test 5: MFG absence

**Input:** Any print layout request

**Expected behavior:**

-   No file references `MfgVisit`, `MfgQuality`, `MfgAgreements`, or any `Mfg*` class
-   Examples use Order, Visit, Product, Tour, Call, or Promotion modules only

**Verification command:**

```bash
grep -rni "mfg" .claude/skills/create-print-layout/ \
  --include="*.md" --include="*.template" | \
  grep -v "MFG check\|Forbidden\|no-MFG\|NO MFG" || echo "NO MFG"
```

**Pass criteria:** Command prints `NO MFG`.
