Added test case for signInUserWithGithub to check if adding 'repo gist'
This commit is contained in:
@@ -252,6 +252,26 @@ describe("FirebaseInstance", () => {
|
|||||||
|
|
||||||
await expect(fb.signInUserWithGithub()).rejects.toEqual("test error")
|
await expect(fb.signInUserWithGithub()).rejects.toEqual("test error")
|
||||||
})
|
})
|
||||||
|
test("adds 'repo gist' scope", async () => {
|
||||||
|
const fbFunc = jest.spyOn(mockAuth, "signInWithPopup")
|
||||||
|
|
||||||
|
const addScopeMock = jest.fn()
|
||||||
|
|
||||||
|
const fb = new FirebaseInstance(mocksdk, {
|
||||||
|
github: () => {
|
||||||
|
return {
|
||||||
|
addScope: addScopeMock
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
signOutUser()
|
||||||
|
|
||||||
|
fbFunc.mockImplementation(() => Promise.resolve("test"))
|
||||||
|
await fb.signInUserWithGithub()
|
||||||
|
|
||||||
|
expect(addScopeMock).toBeCalledWith("repo gist")
|
||||||
|
})
|
||||||
test("resolves the response the firebase request resolves", async () => {
|
test("resolves the response the firebase request resolves", async () => {
|
||||||
const fbFunc = jest.spyOn(mockAuth, "signInWithPopup")
|
const fbFunc = jest.spyOn(mockAuth, "signInWithPopup")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user