# Tests — create-list-object skill

Self-test checklist. Run these against a fresh conversation to verify the skill activates and produces correct output.

---

## Test 1: Skill activates on trigger phrases

**Input prompt:** "Create an LO for a list of open visits."

**Expected behavior:**

-   Skill activates (trigger phrase "create an LO" matches description)
-   Invokes `verify-sqlite-schema` for the Visit table before writing any XML
-   Produces `LoVisit.listobject.xml` and `LiVisit.listitem.xml` as outputs (or similarly named files)

**Pass criteria:** Both files produced, `verify-sqlite-schema` invoked first, no MFG references.

---

## Test 2: Basic LO+LI pair structure is correct

**Input prompt:** "Create a list object and list item for Order records. Each row shows orderId, customerName, totalAmount, and orderDate."

**Expected output structure:**

`LoOrder.listobject.xml`:

-   Root: `<ListObject name="LoOrder" generateLoadMethod="true" schemaVersion="1.1" paging="false">`
-   Contains: `<DataSource name="DsLoOrder"/>`, `<Item objectClass="LiOrder"/>`, `<Methods>` with at least `loadAsync`, `beforeLoadAsync`, `afterLoadAsync`

`LiOrder.listitem.xml`:

-   Root: `<ListItem name="LiOrder">`
-   Contains: exactly one `id="true"` property (pKey)
-   Properties: `orderId`/`pKey`, `customerName`, `totalAmount` (type `DomMoney` or `DomDecimal`), `orderDate` (type `DomDate`)
-   All DS-mapped properties have `dataSourceProperty` set

**Pass criteria:** Both files structurally correct, `<Item objectClass="LiOrder"/>` matches `<ListItem name="LiOrder">`, no MFG references.

---

## Test 3: Context-menu LO uses correct empty-DS pattern

**Input prompt:** "Create a context menu LO for Visit actions. Items should have a label, icon, and processEvent."

**Expected output structure:**

`DsLoVisitActionsContextMenu_sf.datasource.xml` (or similar):

-   `external="true"`, `editableEntity=""`
-   `<Database><Load>` block with `return undefined;`

`LoVisitActionsContextMenu.listobject.xml`:

-   `generateLoadMethod="false"`
-   `<Methods>` includes `<Method name="beforeLoadAsync"/>`

`LiVisitActionsContextMenu.listitem.xml`:

-   `id` property (pKey), `actionImg`, `actionId`/`actionEnabled`/`actionVisible`, `processEvent`

**Pass criteria:** DS has `external="true"` and `return undefined;`, LO has `generateLoadMethod="false"`, `beforeLoadAsync` declared.

---

## Test 4: Undefined LI property catch

**Input prompt (simulate a mistake):** "Create an LO for Product. LI should have a `productName` property from the DS attribute `name`."

**Expected behavior:**

-   Skill writes `<SimpleProperty name="productName" type="DomText" dataSourceProperty="name"/>`
-   If the DS attribute is actually named `productName` (not `name`), the skill catches the mismatch via `verify-sqlite-schema` / DS attribute check and corrects `dataSourceProperty`

**Pass criteria:** Skill never silently mismatches `dataSourceProperty` — it verifies the DS attribute name before committing.

---

## Test 5: Decision table — context menu vs basic list vs quick filter

**Input prompts (three separate prompts):**

1. "I need a right-click menu for order rows."
2. "I need a list showing all active tours for this week."
3. "I need a category filter dropdown above the product list."

**Expected output per prompt:**

1. Context-menu template (LO with `generateLoadMethod="false"`, DS returns `undefined`)
2. Basic-list template (LO with `generateLoadMethod="true"`, DS is declarative)
3. Basic-list pair with `generateLoadMethod="false"`, LI has a `DomFilterBool` `isSelected` property

**Pass criteria:** Correct variant selected for each use case, correct `generateLoadMethod` value in each.

---

## Test 6: No MFG references in any output

**Expected behavior:** Skill never produces examples or file references containing "MFG", "MfgVisit", "MfgQuality", or "MfgAgreements".

**Verification command:**

```bash
grep -rni "mfg" .claude/skills/create-list-object/ | grep -v "Forbidden" || echo "NO MFG"
```

**Pass criteria:** Output is `NO MFG`.

---

## Test 7: Real getListAsync caller cited correctly

**Input prompt:** "Show me how to call getListAsync for LoVisit."

**Expected behavior:**

-   Skill cites `src/Visit/BO/LoVisit/Mv2/LoVisit.GetVisitsByDate.bl.js`, line 113 as a real example
-   Shows the `jsonQuery.params` array pattern with `plannedStartDate` and `plannedEndDate`
-   Notes that `Facade.getListAsync` returns an array, not an LO, so `me.addItems(list, ...)` is required

**Pass criteria:** Real file path and line number cited, parameter flow correctly described.
