Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
* update to latest @snowtop/ent
* update to latest jest
* remove uses of fail in test as it doesn't seem it's being fixed anytime soon per DefinitelyTyped/DefinitelyTyped#55803 and jestjs/jest#11698
  • Loading branch information
lolopinto committed Dec 7, 2021
1 parent b969f2c commit f1c2687
Show file tree
Hide file tree
Showing 36 changed files with 5,023 additions and 7,219 deletions.
2,119 changes: 1,251 additions & 868 deletions examples/ent-rsvp/backend/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/ent-rsvp/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"@sentry/node": "^6.3.0",
"@sentry/tracing": "^6.3.0",
"@snowtop/ent": "^0.0.28-alpha.2",
"@snowtop/ent": "^0.0.28",
"@snowtop/ent-email": "0.0.1",
"@snowtop/ent-passport": "0.0.1",
"@snowtop/ent-password": "0.0.1",
Expand All @@ -54,9 +54,9 @@
"@types/luxon": "^2.0.4",
"@types/passport": "^1.0.7",
"@types/supertest": "^2.0.11",
"jest": "^27.1.1",
"jest": "^27.4.3",
"jest-expect-message": "^1.0.2",
"ts-jest": "^27.0.5",
"ts-jest": "^27.1.0",
"tsconfig-paths": "^3.11.0"
}
}
4 changes: 2 additions & 2 deletions examples/ent-rsvp/backend/src/ent/tests/event.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("create event", () => {
await CreateEventAction.create(new LoggedOutViewer(), {
name: `${user.firstName}'s wedding`,
}).saveX();
fail("should have thrown");
throw new Error("should have thrown");
} catch (e) {
expect((e as Error).message).toMatch(
/Logged out Viewer does not have permission to create Event/,
Expand Down Expand Up @@ -69,7 +69,7 @@ describe("create event", () => {
const activity = activities.find((a) => a.name == "closing brunch");
expect(activity).toBeDefined();
if (!activity) {
fail("impossicant");
throw new Error("impossicant");
}
const address = await Address.loadFromOwnerID(activity.viewer, activity.id);
expect(address).not.toBe(null);
Expand Down
16 changes: 8 additions & 8 deletions examples/ent-rsvp/backend/src/ent/tests/event_activity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("create event activity", () => {
name: "welcome dinner",
eventID: event.id,
}).saveX();
fail("should have thrown");
throw new Error("should have thrown");
} catch (e) {
expect((e as Error).message).toMatch(
/Viewer with ID (.+) does not have permission to create EventActivity/,
Expand Down Expand Up @@ -93,7 +93,7 @@ describe("load activity", () => {
]);
try {
await EventActivity.loadX(new IDViewer(user.id), activity.id);
fail("should have thrown");
throw new Error("should have thrown");
} catch (e) {
expect((e as Error).message).toMatch(
/^ent (.+) is not visible for privacy reasons$/,
Expand Down Expand Up @@ -123,7 +123,7 @@ describe("invites", () => {
activity.id,
group.id,
);
fail("should have thrown");
throw new Error("should have thrown");
} catch (e) {
expect((e as Error).message).toMatch(
/^ent (.+) is not visible for privacy reasons$/,
Expand All @@ -148,7 +148,7 @@ describe("invites", () => {
activity2.id,
group.id,
);
fail("should have thrown");
throw new Error("should have thrown");
} catch (e) {
expect((e as Error).message).toMatch(
/Viewer with ID (.+) does not have permission to edit EventActivity/,
Expand Down Expand Up @@ -187,7 +187,7 @@ describe("invites", () => {
activity.id,
group.id,
);
fail("should have thrown");
throw new Error("should have thrown");
} catch (e) {
expect((e as Error).message).toMatch(
/^ent (.+) is not visible for privacy reasons$/,
Expand All @@ -209,7 +209,7 @@ describe("invites", () => {
activity.id,
group2.id,
);
fail("should have thrown");
throw new Error("should have thrown");
} catch (e) {
expect((e as Error).message).toMatch(
/Viewer with ID (.+) does not have permission to edit EventActivity/,
Expand Down Expand Up @@ -510,7 +510,7 @@ describe("rsvps", () => {
rsvpStatus: EventActivityRsvpStatusInput.Attending,
},
);
fail("should have thrown");
throw new Error("should have thrown");
} catch (e) {
expect((e as Error).message).toMatch(
/^ent (.+) is not visible for privacy reasons$/,
Expand Down Expand Up @@ -540,7 +540,7 @@ describe("rsvps", () => {
rsvpStatus: EventActivityRsvpStatusInput.Attending,
},
);
fail("should have thrown");
throw new Error("should have thrown");
} catch (e) {
expect((e as Error).message).toMatch(
/^ent (.+) is not visible for privacy reasons$/,
Expand Down
4 changes: 2 additions & 2 deletions examples/ent-rsvp/backend/src/ent/tests/guest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ test("create guests", async () => {
expect(guest).toBeInstanceOf(Guest);

if (!guest) {
fail("impossicant");
throw new Error("impossicant");
}

const code = await AuthCode.loadFromGuestID(guest.viewer, guest.id);
expect(code).toBeInstanceOf(AuthCode);

if (!code) {
fail("impossicant");
throw new Error("impossicant");
}
expect(code.emailAddress).toBe(guest.emailAddress);
expect(code.guestID).toBe(guest.id);
Expand Down
8 changes: 4 additions & 4 deletions examples/ent-rsvp/backend/src/ent/tests/guest_group.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("create guest group", () => {
invitationName: "people",
eventID: event.id,
}).saveX();
fail("should have thrown");
throw new Error("should have thrown");
} catch (e) {
expect((e as Error).message).toMatch(
/Viewer with ID (.+) does not have permission to create GuestGroup/,
Expand Down Expand Up @@ -112,7 +112,7 @@ test("load guest group", async () => {

try {
await GuestGroup.loadX(new IDViewer(user.id), guestGroup.id);
fail("should have thrown");
throw new Error("should have thrown");
} catch (e) {
expect((e as Error).message).toMatch(
/^ent (.+) is not visible for privacy reasons$/,
Expand All @@ -135,7 +135,7 @@ describe("edit guest group", () => {
await EditGuestGroupAction.create(new IDViewer(user.id), group, {
invitationName: "foo",
}).saveX();
fail("should have thrown");
throw new Error("should have thrown");
} catch (e) {
expect((e as Error).message).toMatch(
/Viewer with ID (.+) does not have permission to edit GuestGroup/,
Expand All @@ -156,7 +156,7 @@ describe("delete guest group", () => {
const [group, user] = await Promise.all([createGuestGroup(), createUser()]);
try {
await DeleteGuestGroupAction.create(new IDViewer(user.id), group).saveX();
fail("should have thrown");
throw new Error("should have thrown");
} catch (e) {
expect((e as Error).message).toMatch(
/Viewer with ID (.+) does not have permission to delete GuestGroup/,
Expand Down
Loading

0 comments on commit f1c2687

Please sign in to comment.