Apply patch [skip ci]
This commit is contained in:
parent
19b42e993d
commit
50c4479e86
@ -18,8 +18,8 @@ test("tenant can request lease approval", async ({ page }: { page: Page }) => {
|
||||
});
|
||||
expect(inviteResponse.ok()).toBeTruthy();
|
||||
|
||||
const inviteData = await inviteResponse.json();
|
||||
const inviteId = inviteData?.invite?.id || "";
|
||||
const invitePayload = await inviteResponse.json();
|
||||
const inviteId = invitePayload?.invite?.id || "";
|
||||
expect(inviteId).toBeTruthy();
|
||||
|
||||
// Request lease approval
|
||||
@ -33,10 +33,10 @@ test("tenant can request lease approval", async ({ page }: { page: Page }) => {
|
||||
|
||||
expect(approvalResponse.ok()).toBeTruthy();
|
||||
|
||||
const approvalData = await approvalResponse.json();
|
||||
expect(approvalData?.success).toBeTruthy();
|
||||
expect(approvalData?.lease).toBeDefined();
|
||||
expect(approvalData?.lease?.approval_status).toBe("pending_approval");
|
||||
const approvalPayload = await approvalResponse.json();
|
||||
expect(approvalPayload?.success).toBeTruthy();
|
||||
expect(approvalPayload?.lease).toBeDefined();
|
||||
expect(approvalPayload?.lease?.approval_status).toBe("pending_approval");
|
||||
});
|
||||
|
||||
test("landlord can view pending approvals on dashboard", async ({ page }: { page: Page }) => {
|
||||
@ -52,8 +52,8 @@ test("landlord can view pending approvals on dashboard", async ({ page }: { page
|
||||
},
|
||||
});
|
||||
|
||||
const inviteData = await inviteResponse.json();
|
||||
const inviteId = inviteData?.invite?.id || "";
|
||||
const invitePayload = await inviteResponse.json();
|
||||
const inviteId = invitePayload?.invite?.id || "";
|
||||
|
||||
await page.request.post("/api/lease/request-approval", {
|
||||
headers: { "Content-Type": "application/json", ...e2eHeaders("tenant") },
|
||||
@ -88,8 +88,8 @@ test("landlord can view pending approvals on dedicated page", async ({ page }: {
|
||||
},
|
||||
});
|
||||
|
||||
const inviteData = await inviteResponse.json();
|
||||
const inviteId = inviteData?.invite?.id || "";
|
||||
const invitePayload = await inviteResponse.json();
|
||||
const inviteId = invitePayload?.invite?.id || "";
|
||||
|
||||
await page.request.post("/api/lease/request-approval", {
|
||||
headers: { "Content-Type": "application/json", ...e2eHeaders("tenant") },
|
||||
@ -128,8 +128,8 @@ test("landlord can approve a lease", async ({ page }: { page: Page }) => {
|
||||
},
|
||||
});
|
||||
|
||||
const inviteData = await inviteResponse.json();
|
||||
const inviteId = inviteData?.invite?.id || "";
|
||||
const invitePayload = await inviteResponse.json();
|
||||
const inviteId = invitePayload?.invite?.id || "";
|
||||
|
||||
await page.request.post("/api/lease/request-approval", {
|
||||
headers: { "Content-Type": "application/json", ...e2eHeaders("tenant") },
|
||||
@ -139,8 +139,8 @@ test("landlord can approve a lease", async ({ page }: { page: Page }) => {
|
||||
},
|
||||
});
|
||||
|
||||
const approvalData = await approvalResponse.json();
|
||||
const leaseId = approvalData?.lease?.id || "";
|
||||
const approvalPayload = await approvalResponse.json();
|
||||
const leaseId = approvalPayload?.lease?.id || "";
|
||||
|
||||
// Navigate to approvals page
|
||||
await page.goto("/landlord/approvals");
|
||||
@ -177,8 +177,8 @@ test("landlord can reject a lease with reason", async ({ page }: { page: Page })
|
||||
},
|
||||
});
|
||||
|
||||
const inviteData = await inviteResponse.json();
|
||||
const inviteId = inviteData?.invite?.id || "";
|
||||
const invitePayload = await inviteResponse.json();
|
||||
const inviteId = invitePayload?.invite?.id || "";
|
||||
|
||||
await page.request.post("/api/lease/request-approval", {
|
||||
headers: { "Content-Type": "application/json", ...e2eHeaders("tenant") },
|
||||
@ -188,8 +188,8 @@ test("landlord can reject a lease with reason", async ({ page }: { page: Page })
|
||||
},
|
||||
});
|
||||
|
||||
const approvalData = await approvalResponse.json();
|
||||
const leaseId = approvalData?.lease?.id || "";
|
||||
const approvalPayload = await approvalResponse.json();
|
||||
const leaseId = approvalPayload?.lease?.id || "";
|
||||
|
||||
// Navigate to approvals page
|
||||
await page.goto("/landlord/approvals");
|
||||
@ -227,8 +227,8 @@ test("tenant sees updated approval status on invite page", async ({ page }: { pa
|
||||
},
|
||||
});
|
||||
|
||||
const inviteData = await inviteResponse.json();
|
||||
const inviteId = inviteData?.invite?.id || "";
|
||||
const invitePayload = await inviteResponse.json();
|
||||
const inviteId = invitePayload?.invite?.id || "";
|
||||
|
||||
await page.request.post("/api/lease/request-approval", {
|
||||
headers: { "Content-Type": "application/json", ...e2eHeaders("tenant") },
|
||||
@ -238,8 +238,8 @@ test("tenant sees updated approval status on invite page", async ({ page }: { pa
|
||||
},
|
||||
});
|
||||
|
||||
const approvalData = await approvalResponse.json();
|
||||
const leaseId = approvalData?.lease?.id || "";
|
||||
const approvalPayload = await approvalResponse.json();
|
||||
const leaseId = approvalPayload?.lease?.id || "";
|
||||
|
||||
// Approve lease as landlord
|
||||
await page.request.post("/api/lease/approve", {
|
||||
@ -271,8 +271,8 @@ test("tenant sees rejected status on invite page", async ({ page }: { page: Page
|
||||
},
|
||||
});
|
||||
|
||||
const inviteData = await inviteResponse.json();
|
||||
const inviteId = inviteData?.invite?.id || "";
|
||||
const invitePayload = await inviteResponse.json();
|
||||
const inviteId = invitePayload?.invite?.id || "";
|
||||
|
||||
await page.request.post("/api/lease/request-approval", {
|
||||
headers: { "Content-Type": "application/json", ...e2eHeaders("tenant") },
|
||||
@ -282,8 +282,8 @@ test("tenant sees rejected status on invite page", async ({ page }: { page: Page
|
||||
},
|
||||
});
|
||||
|
||||
const approvalData = await approvalResponse.json();
|
||||
const leaseId = approvalData?.lease?.id || "";
|
||||
const approvalPayload = await approvalResponse.json();
|
||||
const leaseId = approvalPayload?.lease?.id || "";
|
||||
|
||||
const rejectionReason = "Property not available";
|
||||
await page.request.post("/api/lease/reject", {
|
||||
@ -383,8 +383,8 @@ test("landlord cannot approve lease they don't own", async ({ page }: { page: Pa
|
||||
},
|
||||
});
|
||||
|
||||
const inviteData = await inviteResponse.json();
|
||||
const inviteId = inviteData?.invite?.id || "";
|
||||
const invitePayload = await inviteResponse.json();
|
||||
const inviteId = invitePayload?.invite?.id || "";
|
||||
|
||||
await page.request.post("/api/lease/request-approval", {
|
||||
headers: { "Content-Type": "application/json", ...e2eHeaders("tenant") },
|
||||
@ -394,8 +394,8 @@ test("landlord cannot approve lease they don't own", async ({ page }: { page: Pa
|
||||
},
|
||||
});
|
||||
|
||||
const approvalData = await approvalResponse.json();
|
||||
const leaseId = approvalData?.lease?.id || "";
|
||||
const approvalPayload = await approvalResponse.json();
|
||||
const leaseId = approvalPayload?.lease?.id || "";
|
||||
|
||||
// Try to approve as landlord (should fail)
|
||||
await useE2EUser(page, "landlord");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user