Skip to content

Instantly share code, notes, and snippets.

@declank
Created January 8, 2015 20:19
Show Gist options
  • Save declank/d19b0660e91dd4e4f088 to your computer and use it in GitHub Desktop.
Save declank/d19b0660e91dd4e4f088 to your computer and use it in GitHub Desktop.
Using the Google Client APIs for JavaScript (GAPI) with Mocha Test Framework
<script>
var handleClientLoad = function() {
gapi.client.setApiKey(API_KEY_GOES_HERE);
};
var googleApiScriptTag = document.createElement('script');
googleApiScriptTag.src = "https://apis.google.com/js/client.js?onload=handleClientLoad";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(googleApiScriptTag, firstScriptTag);
mocha.checkLeaks();
mocha.globals(['jQuery', 'gapi', '___jsl', 'osapi', 'iframer', 'gadgets', 'shindig', 'pos', 'googleapis',
'ToolbarApi', 'iframes', 'IframeBase', 'Iframe', 'IframeProxy', 'IframeWindow', '__gapi_jstiming__']);
mocha.run();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment