Skip to content

Commit c9d4e67

Browse files
committed
chore: improve prompting for templates
1 parent 14be7cb commit c9d4e67

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ pactflow-ai generate \
2929
--output ./src/api.pact.spec.ts \
3030
--language typescript \
3131
--openapi ./products.yml \
32-
--endpoint "/product/{id}" \
32+
--endpoint "**" \
3333
--code ./src/product.js \
3434
--code ./src/api.js \
3535
--template ./src/pact.test.template \
36-
--instructions "Write test cases for the positive (HTTP 200) scenario and negative scenarios, specifically the case of 400, 401 and 404"
36+
--instructions @./src/test.instructions.txt
3737
```
3838

3939
#### Other variations

src/pact.test.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ describe("🧱 Thing API", () => {
1111
consumer: "ThingConsumer",
1212
provider: "ThingProvider",
1313
spec: SpecificationVersion.SPECIFICATION_VERSION_V4,
14+
logLevel: "error",
1415
});
1516

1617
// Level 2 - Describe block for the specific API endpoint

src/test.instructions.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
* Make sure to cover happy and non-happy paths
22
* Specifically, ensure to include test cases for the positive (HTTP 200) scenario and negative scenarios, specifically the case of 400, 401 and 404
3+
* Only include endpoints/properties used by the API client - do not include additional fields in the OAS that are not in the client code
4+
* You can check the properties used in the Product class to help make this determination
35
* Use the Jest testing framework
46
* Use the native Jest expect (https://jestjs.io/docs/expect) matchers such as `toEqual` and `toBeTruthy`
57
* Prefer the use of the async/await pattern when using Promises

0 commit comments

Comments
 (0)