
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
gas-mock-service
Advanced tools
This library is dedicated to mock the google apps script services
It accumulates data which can be useful for writing tests and debugging the codebase.
npm install --save-dev gas-mock-service
import { Card } from 'gas-mock-service'
or in Common.js
const Card = require('gas-mock-service')
import { Card } from 'gas-mock-service'
import GenericView from 'src/views/Generic'
import data from '../helpers/mocks/responses/getData.json'
describe('Generic View', () => {
it('Runs the render method and checks the returned data is a card instance', () => {
const card = new GenericView({ data }).render()
expect(card).toBeInstanceOf(Card)
expect(card.printJson()).toMatchSnapshot()
})
})
As you can see using mock services is super easy and straightforward. All you have to do is import the specific class to your test file.
In our expample we use mock API response to use that data in GenericView
constructor call.
Also, we check if the JSON representation of the view corresponds the snapshot.
npm test
npm version
npm publish --access public
NOTE that to contribute you should make sure that:
npm test
CardService
Classes1:
Action
ActionResponse
ActionResponseBuilder
AuthorizationAction
AuthorizationException
Button
ButtonSet
Card
CardAction
CardBuilder
CardHeader
CardSection
ComposeActionResponse
ComposeActionResponseBuilder
Image
ImageButton
KeyValue
setAuthorizationAction(action)
setBottomLabel(text)
setButton(button)
setComposeAction(action, composedEmailType)
setContent(text)
setIcon(icon)
setIconAltText(altText)
setMultiline(multiline)
setOnClickAction(action)
setOnClickOpenLinkAction(action)
setOpenLink(openLink)
setSwitch(switchToSet)
setTopLabel(text)
Navigation
Notification
OpenLink
SectionInput
Suggestions
SuggestionsResponse
SuggestionsResponseBuilder
Switch
TextButton
TextInput
TextParagraph
UniversalActionResponse
UniversalActionResponseBuilder
Widget
Enums:ComposedEmailType
Icon
ImageStyle
LoadIndicator
NotificationType
OnClose
OpenAs
SelectionInputType
PropertiesService
Classes:
CacheService
Classes:
UrlFetchApp
Classes:
All the CardService
classes and their methods which are currently mocked in this library are marked as bold ↩
FAQs
A library that mocks Google Apps Script Services
The npm package gas-mock-service receives a total of 3 weekly downloads. As such, gas-mock-service popularity was classified as not popular.
We found that gas-mock-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.