New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

given2

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

given2

inspired by [given.js](https://github.com/freshtonic/given.js) and [Rspec](http://rspec.info/)

0.0.1
Source
npm
Version published
Weekly downloads
6K
-1.89%
Maintainers
1
Weekly downloads
 
Created
Source

Given2 :exclamation:WIP:exclamation:

inspired by given.js and Rspec

Use given to define a memoized helper method. The value will be cached across multiple calls in the same example but not across examples.

Note that given is lazy-evaluated: it is not evaluated until the first time the method it defines is invoked.

Usage

let count = 0;

describe('given', () => {
  given('count', () => count += 1);

  it('memoizes the value', () => {
    expect(given.count).toBe(1);
    expect(given.count).toBe(1);
  });

  it('is not cached across examples', () => {
    expect(given.count).toBe(2);
  });
});

FAQs

Package last updated on 26 Oct 2017

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