Skip to content

Commit

Permalink
feat: Allow updating target cap
Browse files Browse the repository at this point in the history
  • Loading branch information
d-beezee committed Jun 13, 2024
1 parent 9dbe82d commit 4d1d6c9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/routes/dossiers/campaignId/_put/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ export default class RouteItem extends UserRoute<{
...(this.getBody().target?.size && {
target_size: this.getBody().target?.size,
}),
...(this.getBody().target?.cap && {
cap: this.getBody().target?.cap,
}),
product_type_id: this.getBody().productType,
target_devices: this.getBody().deviceRequirements,
notes: this.getBody().notes,
Expand Down
18 changes: 18 additions & 0 deletions src/routes/dossiers/campaignId/_put/update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,24 @@ describe("Route POST /dossiers", () => {
expect(responseGet.status).toBe(200);
expect(responseGet.body).toHaveProperty("notes", "Notes");
});
it("Should update the cap in the dossier data", async () => {
await request(app)
.put("/dossiers/1")
.set("authorization", "Bearer admin")
.send({
...baseRequest,
target: {
cap: 10,
},
});

const responseGet = await request(app)
.get("/dossiers/1")
.set("authorization", "Bearer admin");
expect(responseGet.status).toBe(200);
expect(responseGet.body).toHaveProperty("target");
expect(responseGet.body.target).toHaveProperty("cap", 10);
});
});

describe("Role handling", () => {
Expand Down

0 comments on commit 4d1d6c9

Please sign in to comment.