Skip to content

Instantly share code, notes, and snippets.

@devinivy
devinivy / stubQueryMethod.js
Last active September 29, 2020 10:31 — forked from wxactly/stubQueryMethod.js
Sails.js: Stub Waterline query method with Sinon.js
var util = require('util');
var _ = require('lodash');
var sinon = require('sinon');
/**
* Replaces a query method on the given model object with a stub. The query
* will still operate on a callback, and allow full access to waterline's
* deferred object. However, the query will not cause any I/O and instead
* will immediately resolve to the given result.
*