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

@travi/any

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travi/any

random data generator for when test data is insignificant

  • 3.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Random data generator

Node CI Workflow Status Codecov SLSA Level 2

Random data generator for when test data is insignificant. Tailoring data too closely for the domain can end up being confusing in tests because it distracts from the behavior that is actually important in the test. This is why I prefer to make it very clear when test data is insignificant by using a data generator. This library captures most of the patterns I use frequently.

Based on Chance.js

To save myself from needing to maintain the actual data generators, this library leverages Chance.js for generating the data. So why not just use Chance.js directly?

  • I find it annoying that an instance of Chance has to be created. Rather than initialize an instance in every module, I wrap a single instance for reuse throughout the tests.
  • I can set my default options to align with my typical conventions rather than having to repeatedly configure Chance.js's very flexible API
  • Lots of my tests need objects to be generated, but the structure of those objects typically does not matter. Chance.js does not have a simple-object generator, so I've included that on my own.
  • Many of my tests need lists generated. Like objects, Chance.js does not generate lists, so I've included this on my own.

Usage

npm monthly downloads license Try @travi/any on RunKit node npm

Install

$ npm install @travi/any --save-dev

Documentation

Contributing

PRs Welcome Conventional Commits Commitizen friendly Renovate semantic-release: angular

Dependencies

$ nvm install
$ npm install

Verification

$ npm test

Typescript Types

When making changes to the API, these changes must be reflected in the types file (index.d.ts). This library uses tsd to test the types. These tests can be found at index.d-test.ts. As you make changes to the API, first update index.d-test.ts with the expected results, then update index.d.ts with the appropriate types to satisfy the tests.

Keywords

FAQs

Package last updated on 07 Nov 2023

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