test(core): enable no-floating-promises rule for tests (#11915)

Sometimes, missing `await` in the test code can cause timing issues, leading to test failures. This PR enables the `no-floating-promises` rule for the test code to ensure that such errors do not occur.
This commit is contained in:
L-Sun
2025-04-23 08:17:41 +00:00
parent 200015a811
commit a9ad01491c
28 changed files with 136 additions and 121 deletions
@@ -6,6 +6,6 @@ export const e2e = test;
// @ts-expect-error created in prelude.ts
export const app: TestingApp = globalThis.app;
registerCompletionHandler(() => {
app.close();
registerCompletionHandler(async () => {
await app.close();
});
@@ -77,7 +77,7 @@ e2e('should leave a workspace', async t => {
userId: u2.id,
});
app.switchUser(u2.id);
await app.switchUser(u2.id);
const { leaveWorkspace } = await app.gql({
query: leaveWorkspaceMutation,
variables: {
@@ -182,7 +182,7 @@ e2e('should invite a user by link', async t => {
},
});
app.switchUser(u2);
await app.switchUser(u2);
const accept = await app.gql({
query: acceptInviteByInviteIdMutation,
variables: {
@@ -192,7 +192,7 @@ e2e('should invite a user by link', async t => {
});
t.true(accept.acceptInviteById, 'failed to accept invite');
app.switchUser(owner);
await app.switchUser(owner);
const invite2 = await app.gql({
query: inviteByEmailMutation,
variables: {
@@ -233,7 +233,7 @@ e2e('should send invitation notification and leave email', async t => {
t.is(invitationNotification.payload.inviterId, owner.id);
t.is(invitationNotification.payload.inviteId, invite.invite);
app.switchUser(u2);
await app.switchUser(u2);
const accept = await app.gql({
query: acceptInviteByInviteIdMutation,
variables: {