Skip to content

Commit

Permalink
Fix test failure for getUserByLoginWithRetry
Browse files Browse the repository at this point in the history
  • Loading branch information
fflorent authored and Florent F committed Aug 6, 2024
1 parent 26dfc0b commit 2cf3fdb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/gen-server/lib/homedb/HomeDBManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,14 @@ export class HomeDBManager extends EventEmitter {
* @see UsersManager.prototype.getUserByLoginWithRetry
*/
public async getUserByLoginWithRetry(email: string, options: GetUserOptions = {}): Promise<User> {
return await this._usersManager.getUserByLoginWithRetry(email, options);
return this._usersManager.getUserByLoginWithRetry(email, options);
}

/**
* @see UsersManager.prototype.getUserByLogin
*/
public async getUserByLogin(email: string, options: GetUserOptions = {}): Promise<User> {
return await this._usersManager.getUserByLogin(email, options);
return this._usersManager.getUserByLogin(email, options);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/gen-server/lib/homedb/UsersManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export class UsersManager {
// unseen user fires off multiple api calls.
public async getUserByLoginWithRetry(email: string, options: GetUserOptions = {}): Promise<User> {
try {
return this.getUserByLogin(email, options);
return await this.getUserByLogin(email, options);
} catch (e) {
if (e.name === 'QueryFailedError' && e.detail &&
e.detail.match(/Key \(email\)=[^ ]+ already exists/)) {
Expand Down
2 changes: 1 addition & 1 deletion test/gen-server/lib/homedb/UsersManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ describe('UsersManager', function () {
it('should reject immediately if the error is not a QueryFailedError', async function () {
const errorMsg = 'my error';
sandbox.stub(UsersManager.prototype, 'getUserByLogin')
.rejects(new Error(errorMsg))
.onFirstCall().rejects(new Error(errorMsg))
.callThrough();

const email = makeEmail(ensureUnique('getuserbyloginwithretry-rejects-immediately-when-not-queryfailederror'));
Expand Down

0 comments on commit 2cf3fdb

Please sign in to comment.