Skip to content

Instantly share code, notes, and snippets.

@nrjpoddar
Created March 17, 2017 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrjpoddar/79039078d897831d42e6b72c45553928 to your computer and use it in GitHub Desktop.
Save nrjpoddar/79039078d897831d42e6b72c45553928 to your computer and use it in GitHub Desktop.
Sample code for monkey patching
const transformer = require('transformer');
class MockClient {
constructor() { this._msg = null; }
put(msg) { this._msg = msg; }
getMsg() { return this._msg; }
}
describe('test-transformer', function(done) {
it('putsData', function(data) {
let t = new transformer('testCode');
t._client = new MockClient();
t.puts('I am testing transformer I think?!');
assert.expects(m.getMsg(), 'I am testing transformer for sure!' + 'Hello from testCode');
done();
});
});
@nrjpoddar
Copy link
Author

nrjpoddar commented Mar 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment