-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: make UserProvider functional
- Loading branch information
1 parent
0f46dda
commit 56d7a79
Showing
4 changed files
with
42 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import "mocha"; | ||
import LocalLoginHandler from "@backend/auth/local/local-login.handler.js"; | ||
import TokenHandler from "@backend/auth/token/token.handler.js"; | ||
import { UserProvider } from "@backend/auth/user/user-provider.js"; | ||
import UserProvider from "@backend/auth/user/user-provider.js"; | ||
import UserHandler from "@backend/auth/user/user.handler.js"; | ||
import { BlError } from "@shared/bl-error/bl-error.js"; | ||
import { expect, use as chaiUse, should } from "chai"; | ||
|
@@ -18,7 +18,6 @@ describe("UserProvider", () => { | |
let userValidStub: sinon.SinonStub; | ||
let createTokenStub: sinon.SinonStub; | ||
let createDefaultLocalLoginStub: sinon.SinonStub; | ||
const userProvider = new UserProvider(); | ||
|
||
beforeEach(() => { | ||
sandbox = createSandbox(); | ||
|
@@ -41,7 +40,7 @@ describe("UserProvider", () => { | |
userValidStub.rejects(new BlError("user is not valid")); | ||
|
||
return expect( | ||
userProvider.loginOrCreate("[email protected]", "local", "abcdef"), | ||
UserProvider.loginOrCreate("[email protected]", "local", "abcdef"), | ||
).to.eventually.be.rejectedWith(BlError, /user is not valid/); | ||
}); | ||
|
||
|
@@ -53,7 +52,7 @@ describe("UserProvider", () => { | |
); | ||
|
||
return expect( | ||
userProvider.loginOrCreate("[email protected]", "local", "abcde"), | ||
UserProvider.loginOrCreate("[email protected]", "local", "abcde"), | ||
).to.eventually.be.rejectedWith( | ||
BlError, | ||
/local login could not be created/, | ||
|
@@ -66,7 +65,7 @@ describe("UserProvider", () => { | |
userCreateStub.rejects(new BlError("user could not be created")); | ||
|
||
return expect( | ||
userProvider.loginOrCreate("[email protected]", "local", "abcde"), | ||
UserProvider.loginOrCreate("[email protected]", "local", "abcde"), | ||
).to.eventually.be.rejectedWith(BlError, /user could not be created/); | ||
}); | ||
|
||
|
@@ -80,7 +79,7 @@ describe("UserProvider", () => { | |
createTokenStub.resolves(tokens); | ||
|
||
return expect( | ||
userProvider.loginOrCreate("[email protected]", "local", "abcdefg"), | ||
UserProvider.loginOrCreate("[email protected]", "local", "abcdefg"), | ||
).to.eventually.be.eql({ user: user, tokens: tokens }); | ||
}); | ||
}); | ||
|
@@ -96,7 +95,7 @@ describe("UserProvider", () => { | |
createTokenStub.resolves(tokens); | ||
|
||
return expect( | ||
userProvider.loginOrCreate("[email protected]", "local", "abcdefg"), | ||
UserProvider.loginOrCreate("[email protected]", "local", "abcdefg"), | ||
).to.eventually.be.eql({ user: user, tokens: tokens }); | ||
}); | ||
}); | ||
|