All Projects → fent → node-muk

fent / node-muk

Licence: MIT License
Mock object methods and dependencies.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to node-muk

mock-spy-module-import
JavaScript import/require module testing do's and don'ts with Jest
Stars: ✭ 40 (-29.82%)
Mutual labels:  stub, mocking
Ts Mockito
Mocking library for TypeScript
Stars: ✭ 608 (+966.67%)
Mutual labels:  stub, mocking
Hippolyte
HTTP Stubbing in Swift
Stars: ✭ 109 (+91.23%)
Mutual labels:  stub, mocking
Clj Fakes
An isolation framework for Clojure/ClojureScript.
Stars: ✭ 26 (-54.39%)
Mutual labels:  stub, mocking
Redismock
🕋 Mocking Redis in unit tests in Go.
Stars: ✭ 99 (+73.68%)
Mutual labels:  stub, mocking
Spy
Clojure/ClojureScript library for stubs, spies and mocks.
Stars: ✭ 131 (+129.82%)
Mutual labels:  stub, mocking
Ohhttpstubs
Stub your network requests easily! Test your apps with fake network data and custom response time, response code and headers!
Stars: ✭ 4,831 (+8375.44%)
Mutual labels:  stub, mocking
Wiremockui
Wiremock UI - Tool for creating mock servers, proxies servers and proxies servers with the option to save the data traffic from an existing API or Site.
Stars: ✭ 38 (-33.33%)
Mutual labels:  stub, mocking
Cuckoo
Boilerplate-free mocking framework for Swift!
Stars: ✭ 1,344 (+2257.89%)
Mutual labels:  stub, mocking
Mockery
Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL).
Stars: ✭ 10,048 (+17528.07%)
Mutual labels:  stub, mocking
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 (-29.82%)
Mutual labels:  stub, mocking
bem-express
BEM project-stub with BEMTREE and express
Stars: ✭ 45 (-21.05%)
Mutual labels:  stub
php-rdkafka-stubs
Rdkafka extension stubs for your IDE. Always compatibile with the latest php-rdkafka version.
Stars: ✭ 125 (+119.3%)
Mutual labels:  stub
Retromock
Java library for mocking responses in a Retrofit service.
Stars: ✭ 48 (-15.79%)
Mutual labels:  mocking
InstantMock
Create mocks easily in Swift
Stars: ✭ 88 (+54.39%)
Mutual labels:  stub
mocky
Mocky is a simple API mocking solution written in PHP.
Stars: ✭ 29 (-49.12%)
Mutual labels:  mocking
modern-api-management
A modern approach to manage APIs effectively using Protobuf
Stars: ✭ 36 (-36.84%)
Mutual labels:  stub
ineeda
Mocking library for TypeScript and JavaScript using Proxies!
Stars: ✭ 53 (-7.02%)
Mutual labels:  mocking
mocxx
A versatile C++ function mocking framework.
Stars: ✭ 103 (+80.7%)
Mutual labels:  mocking
xf-application-mocks
Contains lightweight substitutes for SAP applications to ease the development and testing of extension and integration scenarios. In conjunction with SAP Business Technology Platform, kyma runtime, the efficient implementation of application extensions is supported without the need for real SAP applications being accessible during development.
Stars: ✭ 21 (-63.16%)
Mutual labels:  mocking

muk

* Abandoned *

Abandoned in favor of splitting up the functionality into

Build Status Dependency Status codecov

muk

Usage

Mock dependencies.

foo.js

var request = require('request');

module.exports = function foo(url) {
  // do something with request
};

test.js

var mockedRequest = function(url, options, callback) {
  // mock a request here
};

var foo = muk('./foo', {
  request: mockedRequest
});

You can also mock modules required with a relative path.

some/where/else/foo.js

var bar = require('./bar');

module.exports = function() {
  // do something with bar
};

some/where/else/bar.js

exports.attack = 'sludge attack!';

test.js

var foo = muk('./some/where/else/foo', { './bar': 'hey!!' });

Comes with object method mocking too.

var fs = require('fs');
var muk = require('muk');

muk(fs, 'readFile', function(path, callback) {
  process.nextTick(callback.bind(null, null, 'file contents here'));
});

Check if member has been mocked.

muk.isMocked(fs, 'readFile'); // true

Restore all mocked methods after tests.

muk.restore();

fs.readFile(file, function(err, data) {
  // will actually read from `file`
});

Install

npm install muk

Tests

Tests are written with mocha

npm test

License

MIT

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