stub-promise-function
Advanced tools
+7
-4
@@ -0,5 +1,3 @@ | ||
| var stubPromiseFunction = require('stub-promise-function'); | ||
| var stubPromise = require('stub-promise'); | ||
| // code under test | ||
@@ -16,3 +14,3 @@ function getUsers() { | ||
| beforeEach(function() { | ||
| http.get = stubPromise(); | ||
| http.get = stubPromiseFunction(); | ||
| sinon.spy(console, 'log'); | ||
@@ -25,2 +23,7 @@ }); | ||
| it('uses http to get users', () => { | ||
| expect(http.get.called).toBe(true); | ||
| expect(http.get.getCall(0).args[0]).toBe('/users.html'); | ||
| }); | ||
| describe('when getUsers resolves', function() { | ||
@@ -27,0 +30,0 @@ |
+1
-1
| { | ||
| "name": "stub-promise-function", | ||
| "version": "2.0.2", | ||
| "version": "2.0.3", | ||
| "description": "A test utility that lets you stub and control promises for testing purposes", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/jonbern/stub-promise-function.git", |
+8
-3
@@ -34,2 +34,7 @@ # stub-promise-function | ||
| it('uses http to get users', () => { | ||
| expect(http.get.called).toBe(true); | ||
| expect(http.get.getCall(0).args[0]).toBe('/users.html'); | ||
| }); | ||
| describe('when getUsers resolves', function() { | ||
@@ -67,3 +72,3 @@ | ||
| http = { | ||
| get: stubPromise() | ||
| get: stubPromiseFunction() | ||
| }; | ||
@@ -146,3 +151,3 @@ }); | ||
| http = { | ||
| get: stubPromise() | ||
| get: stubPromiseFunction() | ||
| }; | ||
@@ -163,3 +168,3 @@ | ||
| it('can be reinstantiated and then resolved', function() { | ||
| http.get = stubPromise(); | ||
| http.get = stubPromiseFunction(); | ||
@@ -166,0 +171,0 @@ promise = http.get('http://another'); |
9239
3.83%134
3.08%183
2.81%