mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 06:43:35 +00:00
fix send-created tests (#11813)
This commit is contained in:
@@ -50,7 +50,7 @@ describe("SendCreatedComponent", () => {
|
|||||||
|
|
||||||
sendView = {
|
sendView = {
|
||||||
id: sendId,
|
id: sendId,
|
||||||
deletionDate: new Date(),
|
deletionDate: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),
|
||||||
type: SendType.Text,
|
type: SendType.Text,
|
||||||
accessId: "abc",
|
accessId: "abc",
|
||||||
urlB64Key: "123",
|
urlB64Key: "123",
|
||||||
@@ -127,8 +127,8 @@ describe("SendCreatedComponent", () => {
|
|||||||
|
|
||||||
it("should initialize send, daysAvailable, and hoursAvailable", () => {
|
it("should initialize send, daysAvailable, and hoursAvailable", () => {
|
||||||
expect(component["send"]).toBe(sendView);
|
expect(component["send"]).toBe(sendView);
|
||||||
expect(component["daysAvailable"]).toBe(0);
|
expect(component["daysAvailable"]).toBe(7);
|
||||||
expect(component["hoursAvailable"]).toBe(0);
|
expect(component["hoursAvailable"]).toBe(168);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should navigate back to the edit send form on close", async () => {
|
it("should navigate back to the edit send form on close", async () => {
|
||||||
@@ -140,7 +140,6 @@ describe("SendCreatedComponent", () => {
|
|||||||
|
|
||||||
describe("getHoursAvailable", () => {
|
describe("getHoursAvailable", () => {
|
||||||
it("returns the correct number of hours", () => {
|
it("returns the correct number of hours", () => {
|
||||||
sendView.deletionDate.setDate(sendView.deletionDate.getDate() + 7);
|
|
||||||
sendViewsSubject.next([sendView]);
|
sendViewsSubject.next([sendView]);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
@@ -150,7 +149,7 @@ describe("SendCreatedComponent", () => {
|
|||||||
|
|
||||||
describe("formatExpirationDate", () => {
|
describe("formatExpirationDate", () => {
|
||||||
it("returns days plural if expiry is more than 24 hours", () => {
|
it("returns days plural if expiry is more than 24 hours", () => {
|
||||||
sendView.deletionDate.setDate(sendView.deletionDate.getDate() + 7);
|
sendView.deletionDate = new Date(Date.now() + 168 * 60 * 60 * 1000);
|
||||||
sendViewsSubject.next([sendView]);
|
sendViewsSubject.next([sendView]);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
@@ -158,7 +157,7 @@ describe("SendCreatedComponent", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("returns days singular if expiry is 24 hours", () => {
|
it("returns days singular if expiry is 24 hours", () => {
|
||||||
sendView.deletionDate.setDate(sendView.deletionDate.getDate() + 1);
|
sendView.deletionDate = new Date(Date.now() + 24 * 60 * 60 * 1000);
|
||||||
sendViewsSubject.next([sendView]);
|
sendViewsSubject.next([sendView]);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
@@ -166,7 +165,7 @@ describe("SendCreatedComponent", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("returns hours plural if expiry is more than 1 hour but less than 24", () => {
|
it("returns hours plural if expiry is more than 1 hour but less than 24", () => {
|
||||||
sendView.deletionDate.setHours(sendView.deletionDate.getHours() + 2);
|
sendView.deletionDate = new Date(Date.now() + 2 * 60 * 60 * 1000);
|
||||||
sendViewsSubject.next([sendView]);
|
sendViewsSubject.next([sendView]);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
@@ -174,7 +173,7 @@ describe("SendCreatedComponent", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("returns hours singular if expiry is in 1 hour", () => {
|
it("returns hours singular if expiry is in 1 hour", () => {
|
||||||
sendView.deletionDate.setHours(sendView.deletionDate.getHours() + 1);
|
sendView.deletionDate = new Date(Date.now() + 1 * 60 * 60 * 1000);
|
||||||
sendViewsSubject.next([sendView]);
|
sendViewsSubject.next([sendView]);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user