# Tests — create-lookup-object skill

Manual self-test checklist. Run through each scenario to verify the skill activates correctly and produces correct artifacts.

---

## Test 1: Activation — reference lookup trigger phrase

**Input prompt:** "Create a lookup object for ProductGroup"
**Expected:** Skill activates. Outputs `LuProductGroup.lookupobject.xml` in `src/Product/BO/LuProductGroup/` and `DsLuProductGroup_sf.datasource.xml` in `src/Product/DS/`.
**Verify:** The LU root element is `<LookupObject name="LuProductGroup" generateLoadMethod="true" schemaVersion="1.1">`.

---

## Test 2: Activation — dot-extension trigger phrase

**Input prompt:** "I need a .lookupobject.xml for the RetailStore contact reference"
**Expected:** Skill activates. Outputs `LuContact.lookupobject.xml` with `<DataSource name="DsLuContact"/>`.
**Verify:** No `<ObjectLookups>`, `<NestedObjects>`, or `<ListObjects>` tags appear in the output.

---

## Test 3: Basic LU creation passes build

**Scenario:** Write `LuProductGroup.lookupobject.xml` + `DsLuProductGroup_sf.datasource.xml` (declarative, one entity, pKey filter), then run:

```bash
# cd to your workspace root
sf mdl build 2>&1 | tail -20
```

**Expected:** Build exits with 0 errors. No `objectClass not found`, `dataSourceProperty mismatch`, or XSD validation errors.

---

## Test 4: verify-sqlite-schema prerequisite fires before writing

**Scenario:** User says "create a LU for Account" but `Account` table is not in `app.db3`.
**Expected:** Skill invokes `verify-sqlite-schema` first. If the table is missing, skill halts and reports the missing table rather than writing a broken DS.
**Verify:** No DS or LU file is written when the schema check fails.

---

## Test 5: LU vs BO decision — user asks for editable record

**Input prompt:** "Create a lookup object for Visit so I can edit the status"
**Expected:** Skill recognizes the edit intent and redirects: "LUs are read-only. For editing a Visit, use `create-business-object` to produce `BoVisit.businessobject.xml`."
**Verify:** No LU file is produced; user receives the correct guidance.

---

## Test 6: Failure mode 3 catch — caller attempts saveAsync on LU

**Scenario:** Review generated BL code that calls `Facade.saveObjectAsync(lu)` where `lu` is a resolved LU instance.
**Expected:** Skill flags this as failure mode 3 ("saveAsync is not a function"). LUs are read-only; instruct the caller to use a BO instead.
**Verify:** The skill's `<Methods>` block in the output contains ONLY `afterLoadAsync` / `beforeLoadAsync` — never `saveAsync`, `createAsync`, or `doValidateAsync`.

---

## Test 7: MFG absence check

Run after any skill execution that produces files:

```bash
grep -rni "mfg\|MfgVisit\|MfgQuality\|MfgAgreements" \
  .claude/skills/create-lookup-object/ | grep -v "Forbidden" || echo "NO MFG"
```

**Expected:** `NO MFG`

All examples in this skill use Product, Visit, RetailStore, Order, and Call module references only.
