fix: turn off permission of GitHub OAuth app fixed #1377
This commit is contained in:
@@ -207,7 +207,7 @@ describe("FirebaseInstance", () => {
|
|||||||
const fb = new FirebaseInstance(mocksdk, {
|
const fb = new FirebaseInstance(mocksdk, {
|
||||||
github: () => {
|
github: () => {
|
||||||
return {
|
return {
|
||||||
addScope: () => {}
|
addScope: () => {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -224,7 +224,7 @@ describe("FirebaseInstance", () => {
|
|||||||
const fb = new FirebaseInstance(mocksdk, {
|
const fb = new FirebaseInstance(mocksdk, {
|
||||||
github: () => {
|
github: () => {
|
||||||
return {
|
return {
|
||||||
addScope: () => {}
|
addScope: () => {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -241,7 +241,7 @@ describe("FirebaseInstance", () => {
|
|||||||
const fb = new FirebaseInstance(mocksdk, {
|
const fb = new FirebaseInstance(mocksdk, {
|
||||||
github: () => {
|
github: () => {
|
||||||
return {
|
return {
|
||||||
addScope: () => {}
|
addScope: () => {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -252,15 +252,15 @@ describe("FirebaseInstance", () => {
|
|||||||
|
|
||||||
await expect(fb.signInUserWithGithub()).rejects.toEqual("test error")
|
await expect(fb.signInUserWithGithub()).rejects.toEqual("test error")
|
||||||
})
|
})
|
||||||
test("adds 'repo gist' scope", async () => {
|
test("adds 'gist' scope", async () => {
|
||||||
const fbFunc = jest.spyOn(mockAuth, "signInWithPopup")
|
const fbFunc = jest.spyOn(mockAuth, "signInWithPopup")
|
||||||
|
|
||||||
const addScopeMock = jest.fn()
|
const addScopeMock = jest.fn()
|
||||||
|
|
||||||
const fb = new FirebaseInstance(mocksdk, {
|
const fb = new FirebaseInstance(mocksdk, {
|
||||||
github: () => {
|
github: () => {
|
||||||
return {
|
return {
|
||||||
addScope: addScopeMock
|
addScope: addScopeMock,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -270,7 +270,7 @@ describe("FirebaseInstance", () => {
|
|||||||
fbFunc.mockImplementation(() => Promise.resolve("test"))
|
fbFunc.mockImplementation(() => Promise.resolve("test"))
|
||||||
await fb.signInUserWithGithub()
|
await fb.signInUserWithGithub()
|
||||||
|
|
||||||
expect(addScopeMock).toBeCalledWith("repo gist")
|
expect(addScopeMock).toBeCalledWith("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")
|
||||||
@@ -278,7 +278,7 @@ describe("FirebaseInstance", () => {
|
|||||||
const fb = new FirebaseInstance(mocksdk, {
|
const fb = new FirebaseInstance(mocksdk, {
|
||||||
github: () => {
|
github: () => {
|
||||||
return {
|
return {
|
||||||
addScope: () => {}
|
addScope: () => {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ export class FirebaseInstance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async signInUserWithGithub() {
|
async signInUserWithGithub() {
|
||||||
return await this.app.auth().signInWithPopup(this.authProviders.github().addScope("repo gist"))
|
return await this.app.auth().signInWithPopup(this.authProviders.github().addScope("gist"))
|
||||||
}
|
}
|
||||||
|
|
||||||
async signInWithEmailAndPassword(email, password) {
|
async signInWithEmailAndPassword(email, password) {
|
||||||
|
|||||||
Reference in New Issue
Block a user