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

gas-mock-globals

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gas-mock-globals

A library that mocks Google Apps Script Services

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
59
increased by37.21%
Maintainers
1
Weekly downloads
 
Created
Source

Gas Mock Globals

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.

Installation

npm install --save-dev gas-mock-globals

Usage

import { Card } from 'gas-mock-globals'

or in Common.js

const Card = require('gas-mock-globals')

Test example (Jest)

import { Card } from 'gas-mock-globals'
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.

Contribution

Running tests

npm test

Publish

npm version
npm publish --access public

NOTE that to contribute you should make sure that:

  • you've covered your code with tests
  • all the tests pass if you run npm test
  • you added your newe added class/service to readme and follow the highlighting pattern

Keywords

FAQs

Package last updated on 25 Oct 2018

Did you know?

Socket

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.

Install

Related posts

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