All Projects β†’ omermorad β†’ mockingbird

omermorad / mockingbird

Licence: MIT license
🐦 Decorator Powered TypeScript Library for Creating Mocks

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to mockingbird

Mockito
Most popular Mocking framework for unit tests written in Java
Stars: ✭ 12,453 (+17690%)
Mutual labels:  mock, mocking, mock-library, mocks
umock-c
A pure C mocking library
Stars: ✭ 29 (-58.57%)
Mutual labels:  mock, mocking, mock-library, mocks
Mockaco
🐡 HTTP mock server, useful to stub services and simulate dynamic API responses, leveraging ASP.NET Core features, built-in fake data generation and pure C# scripting
Stars: ✭ 213 (+204.29%)
Mutual labels:  mock, faker, mocking, mocks
Nsubstitute
A friendly substitute for .NET mocking libraries.
Stars: ✭ 1,646 (+2251.43%)
Mutual labels:  mock, test, mocking, mocks
Faker.js
generate massive amounts of realistic fake data in Node.js and the browser
Stars: ✭ 34,329 (+48941.43%)
Mutual labels:  faker, mocking, mocks
chrome-extension-mocker
The most convenient tool to mock requests for axios, with built-in Chrome extension support.
Stars: ✭ 37 (-47.14%)
Mutual labels:  mock, mocking, mock-library
laika
Log, test, intercept and modify Apollo Client's operations
Stars: ✭ 99 (+41.43%)
Mutual labels:  mock, test, mocking
Mockery
A mock code autogenerator for Golang
Stars: ✭ 3,138 (+4382.86%)
Mutual labels:  mock, mocking, mocks
Hippolyte
HTTP Stubbing in Swift
Stars: ✭ 109 (+55.71%)
Mutual labels:  mock, test, mocking
automock
A library for testing classes with auto mocking capabilities using jest-mock-extended
Stars: ✭ 26 (-62.86%)
Mutual labels:  mock, mocking, unit-test
Faker
Provides fake data to your Android apps :)
Stars: ✭ 234 (+234.29%)
Mutual labels:  mock, faker, mocking
Foundry
A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.
Stars: ✭ 216 (+208.57%)
Mutual labels:  fixtures, test, faker
Alice
Expressive fixtures generator
Stars: ✭ 2,289 (+3170%)
Mutual labels:  fixtures, faker, fixture
aem-stubs
Tool for providing sample data for AEM applications in a simple and flexible way. Stubbing server on AEM, no separate needed.
Stars: ✭ 40 (-42.86%)
Mutual labels:  mock, mocking, mocks
Mimic
Seamless client side mocking
Stars: ✭ 380 (+442.86%)
Mutual labels:  mock, test, mocking
Prig
Prig is a lightweight framework for test indirections in .NET Framework.
Stars: ✭ 106 (+51.43%)
Mutual labels:  mock, test, mocking
Mimesis
Mimesis is a high-performance fake data generator for Python, which provides data for a variety of purposes in a variety of languages.
Stars: ✭ 3,439 (+4812.86%)
Mutual labels:  mock, fixtures, faker
Mocktopus
Mocking framework for Rust
Stars: ✭ 179 (+155.71%)
Mutual labels:  mock, test, mocking
Node Mock Server
File based Node REST API mock server
Stars: ✭ 225 (+221.43%)
Mutual labels:  mock, faker
Pester
Pester is the ubiquitous test and mock framework for PowerShell.
Stars: ✭ 2,620 (+3642.86%)
Mutual labels:  mock, mocking

ISC license npm version Codecov Coverage lerna ci

Mockingbird Logo

Mockingbird

Simple Yet Powerful TypeScript Mocking Library

Manage and create your test mocks easily, and focus on your tests logic instead

Installation

npm i -D mockingbird
yarn add -D mockingbird

What is "Mocking Library"?

A lot of times you find yourself β€œpreparing” some dummy data for your tests that has to make sense for a specific test case(s) and is manipulated often. Some developers are preparing JSON files, others create a long verbose object in the test file itself, but the outcome always contains some fake data inside (or even a snapshot from an external API).

This is what Mockingbird aims to solve! It suggests two ways of creating mocks for your entities/models classes, thus, creating one uniform way to manage mocks (whether you are working alone or with your team), your dev experience will improve, and you won’t have to deal with this messy setup at all!

Features

  • Prepare as many unique mocks/fixtures as you need for your tests
  • Generate dummy (but reasonable) data for database seeding
  • Manage your mocks from one place, forget about the messy work
  • Full TypeScript compatibility
  • Convenient and simple API

Usage

Here is the simplest usage of Mockingbird:

// Could be interface as well
class BirdEntity {
  name: string;
  birthday: Date;
  goodPoints: number;
}
import { Mock, MockFactory } from 'mockingbird';

// BirdEntity could be an interface or a class
class BirdEntityMock implements BirdEntity {
  @Mock(faker => faker.name.firstName())
  name!: string;

  @Mock()
  birthday!: Date; // Will generate a recent date

  @Mock()
  goodPoints!: number; // Will generate a random number
}

const oneBird = MockFactory(BirdEntityMock).one();
const lotsOfBirds = MockFactory(BirdEntityMock).many(3);

Documentation

Jump to the full documentation and explore the full API

There's also an example, you can find it under the sample folder

Playground

Jump to the REPL Playground where you can see Mockingbird in action!

Motivation

Creating mocks for your tests (sometimes called "fixtures") can be a tedious and cumbersome process usually done manually.

We came up with a simple yet super convenient solution: all you have to do to get mocks out of the box is to decorate your classes (whether it's an entity, or a model representing the database layer) and generate simple or complex mocks.

Mockingbird offers two different ways for preparing mocks; The first one (as we call it), is the TypeScript way which requires decorating existing (or duplicate) classes. The second way is to use Mockingbird's functionality directly

What is faker.js?

faker.js it's a library which is used to "generate massive amounts of fake data in the browser and Node".

Mockingbird uses faker.js under the hood, making it possible to enjoy its rich database, and thereby allows to create mocks that are meaningful like email, first name, address and many more.

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements

faker.js

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].