Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/routes/dossiers/_post/creation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ describe("Route POST /dossiers", () => {
.where({ id })
.first();

expect(campaign).toHaveProperty("start_date", "2021-08-24T14:15:22Z");
expect(campaign).toHaveProperty("start_date", "2021-08-24 14:15:22");
});

it("Should create a campaign with the specified end date ", async () => {
Expand All @@ -250,7 +250,7 @@ describe("Route POST /dossiers", () => {
.where({ id })
.first();

expect(campaign).toHaveProperty("end_date", "2021-08-20T14:15:22Z");
expect(campaign).toHaveProperty("end_date", "2021-08-20 14:15:22");
});

it("Should create a campaign with the specified close date ", async () => {
Expand All @@ -271,7 +271,7 @@ describe("Route POST /dossiers", () => {
.where({ id })
.first();

expect(campaign).toHaveProperty("close_date", "2021-08-20T14:15:22Z");
expect(campaign).toHaveProperty("close_date", "2021-08-20 14:15:22");
});

it("Should create a campaign with the end date as start date + 7 if left unspecified", async () => {
Expand All @@ -292,7 +292,7 @@ describe("Route POST /dossiers", () => {
.where({ id })
.first();

expect(campaign).toHaveProperty("end_date", "2021-08-27T14:15:22Z");
expect(campaign).toHaveProperty("end_date", "2021-08-27 14:15:22");
});

it("Should create a campaign with the close date as start date + 14 if left unspecified", async () => {
Expand All @@ -313,7 +313,7 @@ describe("Route POST /dossiers", () => {
.where({ id })
.first();

expect(campaign).toHaveProperty("close_date", "2021-09-03T14:15:22Z");
expect(campaign).toHaveProperty("close_date", "2021-09-03 14:15:22");
});

it("Should create a campaign with current user as pm_id if left unspecified", async () => {
Expand Down
7 changes: 2 additions & 5 deletions src/routes/dossiers/_post/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,13 @@ export default class RouteItem extends UserRoute<{
.insert({
title: this.getBody().title.tester,
platform_id: 0,
/* start_date:
start_date:
this.getBody().startDate?.toString().slice(0, 19).replace("T", " ") ||
"",
end_date:
this.getEndDate()?.toString().slice(0, 19).replace("T", " ") || "",
close_date:
this.getCloseDate()?.toString().slice(0, 19).replace("T", " ") || "",*/
start_date: this.getBody().startDate,
end_date: this.getEndDate(),
close_date: this.getCloseDate(),
this.getCloseDate()?.toString().slice(0, 19).replace("T", " ") || "",
page_preview_id: 0,
page_manual_id: 0,
customer_id: 0,
Expand Down
11 changes: 7 additions & 4 deletions src/routes/dossiers/campaignId/_put/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,16 @@ export default class RouteItem extends UserRoute<{
private async updateCampaign() {
const { os, form_factor } = await this.getDevices();

console.log(typeof this.getBody().target?.cap);
await tryber.tables.WpAppqEvdCampaign.do()
.update({
title: this.getBody().title.tester,
start_date: this.getBody().startDate,
end_date: this.getEndDate(),
close_date: this.getCloseDate(),
start_date:
this.getBody().startDate?.toString().slice(0, 19).replace("T", " ") ||
"",
end_date:
this.getEndDate()?.toString().slice(0, 19).replace("T", " ") || "",
close_date:
this.getCloseDate()?.toString().slice(0, 19).replace("T", " ") || "",
pm_id: this.getBody().csm ?? this.getTesterId(),
project_id: this.getBody().project,
campaign_type_id: this.getBody().testType,
Expand Down
12 changes: 5 additions & 7 deletions src/routes/dossiers/campaignId/_put/update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ describe("Route POST /dossiers", () => {
.where({ id })
.first();

expect(campaign).toHaveProperty("start_date", "2021-08-24T14:15:22Z");
expect(campaign).toHaveProperty("start_date", "2021-08-24 14:15:22");
});

it("Should update the campaign with the specified end date ", async () => {
Expand All @@ -286,7 +286,7 @@ describe("Route POST /dossiers", () => {
.where({ id })
.first();

expect(campaign).toHaveProperty("end_date", "2021-08-20T14:15:22Z");
expect(campaign).toHaveProperty("end_date", "2021-08-20 14:15:22");
});

it("Should update the campaign with the specified close date ", async () => {
Expand All @@ -307,7 +307,7 @@ describe("Route POST /dossiers", () => {
.where({ id })
.first();

expect(campaign).toHaveProperty("close_date", "2021-08-20T14:15:22Z");
expect(campaign).toHaveProperty("close_date", "2021-08-20 14:15:22");
});

it("Should leave the end date of the campaign unedited if left unspecified", async () => {
Expand All @@ -328,7 +328,7 @@ describe("Route POST /dossiers", () => {
.where({ id })
.first();

expect(campaign).toHaveProperty("end_date", "2019-08-24T14:15:22Z");
expect(campaign).toHaveProperty("end_date", "2019-08-24 14:15:22");
});

it("Should leave the close date of the campaign unedited if left unspecified", async () => {
Expand All @@ -349,7 +349,7 @@ describe("Route POST /dossiers", () => {
.where({ id })
.first();

expect(campaign).toHaveProperty("close_date", "2019-08-25T14:15:22Z");
expect(campaign).toHaveProperty("close_date", "2019-08-25 14:15:22");
});

it("Should update the campaign with current user as pm_id", async () => {
Expand Down Expand Up @@ -614,7 +614,6 @@ describe("Route POST /dossiers", () => {
const responseGet = await request(app)
.get("/dossiers/1")
.set("authorization", "Bearer admin");
console.log(responseGet.body);
expect(responseGet.status).toBe(200);
expect(responseGet.body).toHaveProperty("countries", ["DE", "FR"]);
});
Expand All @@ -630,7 +629,6 @@ describe("Route POST /dossiers", () => {
const responseGet = await request(app)
.get("/dossiers/1")
.set("authorization", "Bearer admin");
console.log(responseGet.body);
expect(responseGet.status).toBe(200);
expect(responseGet.body).toHaveProperty("languages");
expect(responseGet.body.languages).toHaveLength(1);
Expand Down