gas-mock-globals
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -0,1 +1,2 @@ | ||
const Action = require('../../../src/card/classes/Action') | ||
const CardAction = require('../../../src/card/classes/CardAction') | ||
@@ -27,2 +28,16 @@ const OpenLink = require('../../../src/card/classes/OpenLink') | ||
}) | ||
it('Should throw an exception when try to call setOnClickAction without an action', () => { | ||
expect(new CardAction().setOnClickAction) | ||
.toThrowError('Invalid value passed for "setOnClickAction"') | ||
}) | ||
it('Should set the on click action', () => { | ||
const onClickAction = new CardAction().setOnClickAction(new Action()) | ||
expect(onClickAction.getData()).toEqual({ | ||
onClick: { | ||
action: {} | ||
} | ||
}) | ||
}) | ||
}) |
@@ -16,3 +16,3 @@ const UrlFetchApp = require('../../src/url-fetch/UrlFetchApp') | ||
const responses = UrlFetchApp.fetchAll({ url: 'www.google.com', params: {} }, { url: 'www.gmail.com', params: {} }) | ||
const responses = UrlFetchApp.fetchAll([{ url: 'www.google.com', params: {} }, { url: 'www.gmail.com', params: {} }]) | ||
@@ -19,0 +19,0 @@ expect(responses).toHaveLength(2) |
{ | ||
"name": "gas-mock-globals", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "A library that mocks Google Apps Script Services", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
const set = require('lodash.set') | ||
const OpenLink = require('./OpenLink') | ||
const BaseClass = require('../../helpers/BaseClass') | ||
const Action = require('./Action') | ||
@@ -21,4 +22,14 @@ class CardAction extends BaseClass { | ||
} | ||
setOnClickAction (action) { | ||
if ((action instanceof Action) === false) { | ||
throw new Error('Invalid value passed for "setOnClickAction"') | ||
} | ||
set(this._data, 'onClick.action', action.getData()) | ||
return this | ||
} | ||
} | ||
module.exports = CardAction |
@@ -9,5 +9,10 @@ // Global Services | ||
const UrlFetchApp = require('./url-fetch/UrlFetchApp') | ||
const HttpResponse = require('./url-fetch/classes/HttpResponse') | ||
const UrlFetchAppStubConfiguration = require('./url-fetch/classes/UrlFetchAppStubConfiguration') | ||
const Session = require('./base/classes/Session') | ||
const Logger = require('./base/classes/Logger') | ||
const SpreadsheetApp = require('./spreadsheetapp/SpreadsheetApp') | ||
const Spreadsheet = require('./spreadsheet/Spreadsheet') | ||
const SpreadsheetStubConfiguration = require('./spreadsheet/classes/SpreadsheetStubConfiguration') | ||
const ScriptAppStubConfiguration = require('./script/classes/ScriptAppStubConfiguration') | ||
@@ -21,4 +26,9 @@ global.Utilities = Utilities | ||
global.UrlFetchApp = UrlFetchApp | ||
global.HttpResponse = HttpResponse | ||
global.Session = Session | ||
global.Logger = Logger | ||
global.UrlFetchAppStubConfiguration = UrlFetchAppStubConfiguration | ||
global.SpreadsheetApp = SpreadsheetApp | ||
global.Spreadsheet = Spreadsheet | ||
global.SpreadsheetStubConfiguration = SpreadsheetStubConfiguration | ||
global.ScriptAppStubConfiguration = ScriptAppStubConfiguration |
@@ -0,7 +1,13 @@ | ||
const ScriptAppStubConfiguration = require('./classes/ScriptAppStubConfiguration') | ||
class ScriptApp { | ||
static getScriptId () { | ||
return 'dummy-script-id' | ||
return ScriptAppStubConfiguration.getScriptId() | ||
} | ||
static getOAuthToken () { | ||
return ScriptAppStubConfiguration.getOAuthToken() | ||
} | ||
} | ||
module.exports = ScriptApp |
@@ -17,3 +17,3 @@ const HttpResponse = require('./classes/HttpResponse') | ||
static fetchAll (...requests) { | ||
static fetchAll (requests) { | ||
return requests.map(request => this.fetch(request.url, request.params)) | ||
@@ -20,0 +20,0 @@ } |
@@ -5,4 +5,8 @@ class Utilities { | ||
} | ||
static formatDate (date, tz, format) { | ||
return '01/02/03 04:05' | ||
} | ||
} | ||
module.exports = Utilities |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59124
81
1862