Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

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

Andrew Bastineeb1ecd2df8b
diff --git a/helpers/__tests__/fb.spec.js b/helpers/__tests__/fb.spec.js
index d9b2a824b..5d864eea5 100644
--- a/helpers/__tests__/fb.spec.js
+++ b/helpers/__tests__/fb.spec.js
@@ -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")