fix: Fix typeorm .save usage (no-changelog) (#8678)

This commit is contained in:
Tomi Turtiainen
2024-02-20 17:34:54 +02:00
committed by GitHub
parent afd2eb1f4a
commit 05e13a68ea
14 changed files with 96 additions and 57 deletions

View File

@@ -192,6 +192,17 @@ describe('MeController', () => {
});
});
describe('storeSurveyAnswers', () => {
it('should throw BadRequestError if answers are missing in the payload', async () => {
const req = mock<MeRequest.SurveyAnswers>({
body: undefined,
});
await expect(controller.storeSurveyAnswers(req)).rejects.toThrowError(
new BadRequestError('Personalization answers are mandatory'),
);
});
});
describe('API Key methods', () => {
let req: AuthenticatedRequest;
beforeAll(() => {

View File

@@ -95,7 +95,7 @@ describe('OwnerController', () => {
await controller.setupOwner(req, res);
expect(userRepository.save).toHaveBeenCalledWith(user);
expect(userRepository.save).toHaveBeenCalledWith(user, { transaction: false });
const cookieOptions = captor<CookieOptions>();
expect(res.cookie).toHaveBeenCalledWith(AUTH_COOKIE_NAME, 'signed-token', cookieOptions);