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

fixture-riveter

Package Overview
Dependencies
Maintainers
3
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fixture-riveter

Fixture replacement library for Typescript

latest
Source
npmnpm
Version
4.0.2
Version published
Maintainers
3
Created
Source

fixture-riveter

GitHub license npm version Mutation testing badge Test status PRs Welcome

fixture-riveter is a fixtures replacement library based on thoughtbot's excellent ruby library factory_bot, with some ideas adapted from factory-girl, another javascript library inspired by factory_bot. It's written in Typescript, is fully async, and implements nearly all of factory_bot's features.

It was built for a knex/objection.js codebase and thus the integration with that ORM is the best. It has support for other ORMs through the use of adapters, but some of the features don't work as well or at all with them.

Installation

Node.js:

npm install --save-dev fixture-riveter

Documentation

A complete guide to using fixture-riveter can be found in the guide. For those interested in code first, here is a simple demonstration:

import {fr, ObjectionAdapter} from "fixture-riveter";

fr.setAdapter(new ObjectionAdapter());

fr.fixture(User, (f) => {
    f.name(() => "Noah");
    f.age(() => 32);
    f.sequence("email", (n) => `test${n}@example.com`);
});

const user = await fr.create(User, {name: "Bogart"});

expect(user).to.be.an.instanceof(User);
expect(user.id).to.exist;
expect(user.name).to.equal("Bogart");
expect(user.age).to.equal(32);
expect(user.email).to.equal("test1@example.com");

Contributing

As this is a very young library, there will be plenty of places it could be improved. No PR is too small, no issue is too weird or out of bounds. Please adhere to our Code of Conduct when participating with this project.

License

Copyright © 2021 Noah Bogart and Batterii, distributed under the license in LICENSE.

Keywords

bdd

FAQs

Package last updated on 07 Jul 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