Added test case for signInUserWithGithub to check if adding 'repo gist'

This commit is contained in:
Andrew Bastin
2020-12-08 23:01:17 -05:00
parent f21b5768a5
commit eeb1ecd2df

View File

@@ -252,6 +252,26 @@ describe("FirebaseInstance", () => {
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 () => {
const fbFunc = jest.spyOn(mockAuth, "signInWithPopup")