mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
Add tests for UsersManager (#1149)
Context
HomeDBManager lacks of direct tests, which makes hard to make rework or refactorations.
Proposed solution
Specifically here, I introduce tests which call exposed UsersManager methods directly and check their result.
Also:
I removed updateUserName which seems to me useless (updateUser does the same work)
Taking a look at the getUserByLogin methods, it appears that Typescirpt infers it returns a Promise<User|null> while in no case it may resolve a nullish value, therefore I have forced to return a Promise<User> and have changed the call sites to reflect the change.
Related issues
I make this change for then working on #870
This commit is contained in:
@@ -79,10 +79,6 @@ async function setupDb() {
|
||||
}
|
||||
const profile = {email, name: email};
|
||||
const user = await db.getUserByLogin(email, {profile});
|
||||
if (!user) {
|
||||
// This should not happen.
|
||||
throw new Error('failed to create GRIST_DEFAULT_EMAIL user');
|
||||
}
|
||||
db.unwrapQueryResult(await db.addOrg(user, {
|
||||
name: org,
|
||||
domain: org,
|
||||
|
||||
Reference in New Issue
Block a user