feat(core): Remove all floating promises. Enforce @typescript-eslint/no-floating-promises (#6281)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-05-24 00:01:45 +00:00
committed by GitHub
parent 5d2f4746ea
commit e046f656fe
33 changed files with 94 additions and 120 deletions

View File

@@ -26,14 +26,14 @@ describe('MeController', () => {
describe('updateCurrentUser', () => {
it('should throw BadRequestError if email is missing in the payload', async () => {
const req = mock<MeRequest.UserUpdate>({});
expect(controller.updateCurrentUser(req, mock())).rejects.toThrowError(
await expect(controller.updateCurrentUser(req, mock())).rejects.toThrowError(
new BadRequestError('Email is mandatory'),
);
});
it('should throw BadRequestError if email is invalid', async () => {
const req = mock<MeRequest.UserUpdate>({ body: { email: 'invalid-email' } });
expect(controller.updateCurrentUser(req, mock())).rejects.toThrowError(
await expect(controller.updateCurrentUser(req, mock())).rejects.toThrowError(
new BadRequestError('Invalid email address'),
);
});
@@ -103,7 +103,7 @@ describe('MeController', () => {
user: mock({ password: undefined }),
body: { currentPassword: '', newPassword: '' },
});
expect(controller.updatePassword(req, mock())).rejects.toThrowError(
await expect(controller.updatePassword(req, mock())).rejects.toThrowError(
new BadRequestError('Requesting user not set up.'),
);
});
@@ -113,7 +113,7 @@ describe('MeController', () => {
user: mock({ password: passwordHash }),
body: { currentPassword: 'not_old_password', newPassword: '' },
});
expect(controller.updatePassword(req, mock())).rejects.toThrowError(
await expect(controller.updatePassword(req, mock())).rejects.toThrowError(
new BadRequestError('Provided current password is incorrect.'),
);
});
@@ -125,7 +125,7 @@ describe('MeController', () => {
user: mock({ password: passwordHash }),
body: { currentPassword: 'old_password', newPassword },
});
expect(controller.updatePassword(req, mock())).rejects.toThrowError(
await expect(controller.updatePassword(req, mock())).rejects.toThrowError(
new BadRequestError(errorMessage),
);
});