mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-28 08:14:25 +02:00
Fixes frontend tests by mocking gapi object
This commit is contained in:
parent
bb89956e9a
commit
371f111706
@ -35,6 +35,11 @@ describe('Login/Recover Widget', function () {
|
|||||||
let dispatch = stub();
|
let dispatch = stub();
|
||||||
|
|
||||||
function renderComponent(props = {session: {pending: false, failed: false}}) {
|
function renderComponent(props = {session: {pending: false, failed: false}}) {
|
||||||
|
window.gapi = {
|
||||||
|
load() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
component = reRenderIntoDocument(
|
component = reRenderIntoDocument(
|
||||||
<MainHomePageLoginWidget dispatch={dispatch} {...props}/>
|
<MainHomePageLoginWidget dispatch={dispatch} {...props}/>
|
||||||
);
|
);
|
||||||
@ -116,6 +121,11 @@ describe('Login/Recover Widget', function () {
|
|||||||
let dispatch = stub();
|
let dispatch = stub();
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
window.gapi = {
|
||||||
|
load() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
component = TestUtils.renderIntoDocument(
|
component = TestUtils.renderIntoDocument(
|
||||||
<MainHomePageLoginWidget dispatch={dispatch} session={{pending: false, failed: false}} />
|
<MainHomePageLoginWidget dispatch={dispatch} session={{pending: false, failed: false}} />
|
||||||
);
|
);
|
||||||
|
@ -68,7 +68,7 @@ class MainHomePageLoginWidget extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderGoogleButton() {
|
renderGoogleButton() {
|
||||||
gapi.load('auth2', () => {
|
window.gapi.load('auth2', () => {
|
||||||
gapi.auth2.init({client_id: '50174278643-gtvjdpm5rmkv75lf3jsp95iv77a2usgu.apps.googleusercontent.com'})
|
gapi.auth2.init({client_id: '50174278643-gtvjdpm5rmkv75lf3jsp95iv77a2usgu.apps.googleusercontent.com'})
|
||||||
gapi.signin2.render('google-oauth-id', {
|
gapi.signin2.render('google-oauth-id', {
|
||||||
scope: 'email',
|
scope: 'email',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user