feat(orders): month/year filter on both order lists + fix received-orders search
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
computeIssuedOrderTotals,
|
||||
createIssuedOrder,
|
||||
getIssuedOrder,
|
||||
listIssuedOrders,
|
||||
updateIssuedOrder,
|
||||
deleteIssuedOrder,
|
||||
} from "../services/issued-orders.service";
|
||||
@@ -219,6 +220,26 @@ describe("deleteIssuedOrder", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("listIssuedOrders month filter", () => {
|
||||
it("returns only orders whose order_date is in the given month", async () => {
|
||||
const inMonth = await createIssuedOrder({ order_date: "2026-03-15" });
|
||||
const outMonth = await createIssuedOrder({ order_date: "2026-04-15" });
|
||||
createdIds.push(inMonth.id, outMonth.id);
|
||||
const res = await listIssuedOrders({
|
||||
page: 1,
|
||||
limit: 50,
|
||||
skip: 0,
|
||||
sort: "id",
|
||||
order: "desc",
|
||||
month: 3,
|
||||
year: 2026,
|
||||
});
|
||||
const ids = res.data.map((o) => o.id);
|
||||
expect(ids).toContain(inMonth.id);
|
||||
expect(ids).not.toContain(outMonth.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe("renderIssuedOrderHtml", () => {
|
||||
const order = {
|
||||
po_number: "26720001",
|
||||
|
||||
Reference in New Issue
Block a user