Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gas-mock-globals

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gas-mock-globals - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

__tests__/scriptapp/ScriptApp.test.js

15

__tests__/card/classes/CardAction.test.js

@@ -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: {}
}
})
})
})

2

__tests__/url-fetch/UrlFetchApp.test.js

@@ -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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc