New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

model-builder-ts

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

model-builder-ts

Reduce boiler plate on testing

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

model-builder-ts

A Node.js module that create models for testing

Installation

npm install model-builder-ts --save-dev

Usage

import {ModelBuilder} from 'model-builder-ts';

interface Person {
  name: string;
  age: number;
  dob: Date;
  married: boolean;
  email?: string;
}

class PersonModelBuilder extends ModelBuilder<Person> {
  public min(): Person {
    return {
      age: 20,
      dob: new Date(0),
      email: '7fate@web.de',
      married: true,
      name: 'Mario',
    } as Person;
  }
}

test('Person ModelBuilder#min', () => {
  const sut = new PersonModelBuilder();

  const person = sut.min();

  expect(person.name).toEqual('Mario');
  expect(person.age).toEqual(20);
  expect(person.dob).toEqual(new Date(0));
  expect(person.married).toEqual(true);
});

License

MIT (unless noted otherwise)

Keywords

Model

FAQs

Package last updated on 30 Jan 2019

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