All Projects → BlinkUX → Sequelize Mock

BlinkUX / Sequelize Mock

Licence: mit
A simple mock interface specifically for testing code relying on Sequelize models

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Sequelize Mock

Sequelize Test Helpers
A collection of utilities to help with unit-testing Sequelize models
Stars: ✭ 83 (-28.45%)
Mutual labels:  sequelize, unit-testing
Swifterswift
A handy collection of more than 500 native Swift extensions to boost your productivity.
Stars: ✭ 10,706 (+9129.31%)
Mutual labels:  unit-testing
Kotlinrxmvparchitecture
Clean MVP Architecture with RxJava + Dagger2 + Retrofit2 + Mockito + Fresco + EasiestGenericRecyclerAdapter using Kotlin. Includes Unit Tests(Kotlin Tests)!
Stars: ✭ 94 (-18.97%)
Mutual labels:  unit-testing
Umzug
Framework agnostic migration tool for Node.js
Stars: ✭ 1,369 (+1080.17%)
Mutual labels:  sequelize
Nodefony Starter
Nodefony Starter Node.js Framework
Stars: ✭ 95 (-18.1%)
Mutual labels:  sequelize
Atoum
The modern, simple and intuitive PHP unit testing framework.
Stars: ✭ 1,382 (+1091.38%)
Mutual labels:  unit-testing
React Redux Starter Kit
Modular starter kit for React+Redux+React Router projects.
Stars: ✭ 92 (-20.69%)
Mutual labels:  unit-testing
Nestjs Graphql
nest-js starter which implement graphql module
Stars: ✭ 111 (-4.31%)
Mutual labels:  sequelize
Rspec
(Rust) Rspec - a BDD test harness for stable Rust
Stars: ✭ 106 (-8.62%)
Mutual labels:  unit-testing
Unit Threaded
Advanced unit test framework for D
Stars: ✭ 100 (-13.79%)
Mutual labels:  unit-testing
Airtap
Run TAP unit tests in 1789+ browsers.
Stars: ✭ 1,364 (+1075.86%)
Mutual labels:  unit-testing
Cuckoo
Boilerplate-free mocking framework for Swift!
Stars: ✭ 1,344 (+1058.62%)
Mutual labels:  unit-testing
Automation Arsenal
Curated list of popular Java and Kotlin frameworks, libraries and tools related to software testing, quality assurance and adjacent processes automation.
Stars: ✭ 105 (-9.48%)
Mutual labels:  unit-testing
Expose
A Dynamic Symbolic Execution (DSE) engine for JavaScript. ExpoSE is highly scalable, compatible with recent JavaScript standards, and supports symbolic modelling of strings and regular expressions.
Stars: ✭ 94 (-18.97%)
Mutual labels:  unit-testing
Moderncppci
This is an example of doing a Modern C++ project with CI
Stars: ✭ 109 (-6.03%)
Mutual labels:  unit-testing
Vue Test
🏁 DEPRECATED: Component testing for Vue.js
Stars: ✭ 92 (-20.69%)
Mutual labels:  unit-testing
Js Unit Testing Guide
📙 A guide to unit testing in Javascript
Stars: ✭ 1,346 (+1060.34%)
Mutual labels:  unit-testing
Xunit.analyzers
Roslyn analyzers for xUnit.net (please open issues in https://github.com/xunit/xunit)
Stars: ✭ 102 (-12.07%)
Mutual labels:  unit-testing
Test
The reference C++ unit testing framework (TDD, xUnit, C++03/11/14/17)
Stars: ✭ 112 (-3.45%)
Mutual labels:  unit-testing
Spring Data Mock
Mock facility for Spring Data repositories
Stars: ✭ 110 (-5.17%)
Mutual labels:  unit-testing

Sequelize Mock

npm CircleCI Coveralls MIT License Documentation Status

A mocking interface designed for testing code that uses Sequelize.

Documentation at sequelize-mock.readthedocs.io

Install

npm i sequelize-mock --save-dev

Getting Started

The Mock Models created with this library function as drop in replacements for your unit testing.

Start by importing the library

var SequelizeMock = require('sequelize-mock');

Initialize the library as you would Sequelize

var DBConnectionMock = new SequelizeMock();

Define your models

var UserMock = DBConnectionMock.define('users', {
		'email': '[email protected]',
		'username': 'blink',
		'picture': 'user-picture.jpg',
	}, {
		instanceMethods: {
			myTestFunc: function () {
				return 'Test User';
			},
		},
	});

Once Mock models have been defined, you can use them as drop-in replacements for your Sequelize model objects. Data is not retrieved from a database and instead is returned based on the setup of the mock objects, the query being made, and other applied or included information.

For example, your code might look something like this

UserMock.findOne({
	where: {
		username: 'my-user',
	},
}).then(function (user) {
	// `user` is a Sequelize Model-like object
	user.get('id');         // Auto-Incrementing ID available on all Models
	user.get('email');      // '[email protected]'; Pulled from default values
	user.get('username');   // 'my-user'; Pulled from the `where` in the query
	
	user.myTestFunc();      // Will return 'Test User' as defined above
});

Contributing

This library is under active development, so you should feel free to submit issues, questions, or pull requests.

License

Created by Blink UX and licensed under the MIT license. Check the LICENSE file for more information.

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].