polish(orders): add no-company test for order-order matcher + backfill route prereq note
This commit is contained in:
parent
14347c4b4b
commit
687c82a4b8
2 changed files with 20 additions and 0 deletions
|
|
@ -7,6 +7,12 @@
|
|||
* on new order creation (see orders-service.ts createOrder) — this
|
||||
* endpoint is what gets historical orders flagged too.
|
||||
*
|
||||
* PREREQUISITE: The 7 PB admin fields documented in the per-matcher
|
||||
* service files (order-number-duplicate-link-service.ts,
|
||||
* order-order-duplicate-link-service.ts, order-delivery-note-link-service.ts)
|
||||
* must exist on the `orders` collection before this endpoint can write
|
||||
* to them. Without the fields, per-order updates will 500.
|
||||
*
|
||||
* Intentionally sequential per order (not Promise.all) — this can run
|
||||
* over the full orders table, and PocketBase's admin client doesn't
|
||||
* love thousands of concurrent requests. This is a background/admin
|
||||
|
|
|
|||
|
|
@ -329,4 +329,18 @@ describe("suggestOrderDuplicate", () => {
|
|||
expect(updated.duplicate_order_match_confidence).toBe(1);
|
||||
expect(updated.potential_duplicate_order).toBe("order-edge-in");
|
||||
});
|
||||
|
||||
it("does not stamp _matching_attempted when order has no company (early return)", async () => {
|
||||
const order = await pbMock.collection("orders").create({
|
||||
id: "order-no-company",
|
||||
// company deliberately omitted
|
||||
});
|
||||
|
||||
const result = await suggestOrderDuplicate(order.id);
|
||||
|
||||
expect(result.duplicateOrderId).toBeNull();
|
||||
expect(result.method).toBe("no_match");
|
||||
const updated = await pbMock.collection("orders").getOne("order-no-company");
|
||||
expect(updated.duplicate_order_matching_attempted).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue