import{au as s,aW as n,_ as a,n as i,U as u,Y as o}from"./chunk-B8Q4vgLh.js";const c=s({action:n().min(1),expected:n().min(1)}),p=s({title:n().min(1),rationale:n().min(1),precondition:n(),steps:i(c).min(1),priority:a(["Critical","High","Medium","Low"]),kind:a(["happy-path","negative","boundary","security","accessibility","performance"])}),m=s({interpretation:n().min(1),cases:i(p).min(1),assumptions:i(n())}),d=["You are a senior QA engineer writing test cases from a requirement.","Cover the happy path, then the ways it can fail: invalid input, missing input, unknown or non-existent","records, expired or already-used tokens, boundary values, duplicate submissions, and rate limiting.","Every step must be a single concrete action a person can perform, with the expected result of THAT step.","Do not invent business rules the requirement does not state. If a rule is needed to write a test,",'state it in "assumptions" instead of embedding it in a case as though it were specified.',"Prefer fewer, sharper cases over many overlapping ones: each case must fail for a distinct reason.",u].join(" ");function f(e){const t=e.targetCount??8;return["Write test cases for this requirement.","",o("Requirement",e.requirement),e.area?o("Feature area",e.area):"","",`Aim for about ${String(t)} cases — fewer if the requirement is narrow, and never pad the list with`,"near-duplicates to reach a number.","","Respond with ONLY a JSON object, no prose, with exactly these keys:","{",'  "interpretation": string,        // one sentence: what you understood the requirement to mean','  "cases": [',"    {",'      "title": string,             // short and specific, e.g. "Reset link that has already been used"','      "rationale": string,         // one sentence: what risk this covers','      "precondition": string,      // state required before step 1, or "" if none','      "steps": [ { "action": string, "expected": string } ],','      "priority": "Critical" | "High" | "Medium" | "Low",','      "kind": "happy-path" | "negative" | "boundary" | "security" | "accessibility" | "performance"',"    }","  ],",'  "assumptions": string[]          // rules you had to assume; empty array if none',"}"].filter(r=>r!=="").join(`
`)}async function l(e,t,r){return(await t.complete({system:d,prompt:f(e),schema:m,label:"test.generation",maxOutputTokens:4e3},r)).value}function y(e){return typeof e=="object"&&e!==null&&e.type==="tcr.agent.generateTests"}function b(e){if(typeof e!="object"||e===null)return!1;const t=e;return!(typeof t.requirement!="string"||t.requirement.trim().length<8||t.area!==void 0&&typeof t.area!="string"||t.targetCount!==void 0&&(typeof t.targetCount!="number"||t.targetCount<1||t.targetCount>30))}function w(e){return`${String(e.steps.length)} step${e.steps.length===1?"":"s"} · ${e.priority}`}export{b as a,w as d,l as g,y as i};
//# sourceMappingURL=chunk-ID1W5T9T.js.map
