mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-02 18:09:58 +08:00
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:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user