Comparing version 0.10.0 to 0.10.1
@@ -0,1 +1,5 @@ | ||
0.10.1 / 2015-10-22 | ||
================= | ||
* [ENHANCEMENT] Adding soap-stub. (#763) | ||
0.10.0 / 2015-10-21 | ||
@@ -2,0 +6,0 @@ ================= |
{ | ||
"name": "soap", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"description": "A minimal node SOAP client", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -494,2 +494,52 @@ # Soap [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] | ||
``` | ||
## soap-stub | ||
Unit testing services that use soap clients can be very cumbersome. In order to get | ||
around this you can use `soap-stub` in conjunction with `sinon` to stub soap with | ||
your clients. | ||
### Example | ||
```javascript | ||
// test-initialization-script.js | ||
var sinon = require('sinon'); | ||
var soapStub = require('soap/soap-stub'); | ||
var urlMyApplicationWillUseWithCreateClient = 'http://path-to-my-wsdl'; | ||
var clientStub = { | ||
SomeOperation: sinon.stub() | ||
}; | ||
clientStub.SomeOperation.respondWithError = soapStub.createRespondingStub({..error json...}); | ||
clientStub.SomeOperation.respondWithSuccess = soapStub.createRespondingStub({..success json...}); | ||
soapStub.registerClient('my client alias', urlMyApplicationWillUseWithCreateClient, clientStub); | ||
// test.js | ||
var soapStub = require('soap/soap-stub'); | ||
describe('myService', function() { | ||
var clientStub; | ||
var myService; | ||
beforeEach(function() { | ||
clientStub = soapStub.getStub('my client alias'); | ||
soapStub.reset(); | ||
myService.init(clientStub); | ||
}); | ||
describe('failures', function() { | ||
beforeEach(function() { | ||
clientStub.SomeOperation.respondWithError(); | ||
}); | ||
it('should handle error responses', function() { | ||
myService.somethingThatCallsSomeOperation(function(err, response) { | ||
// handle the error response. | ||
}); | ||
}); | ||
}); | ||
}); | ||
``` | ||
@@ -496,0 +546,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
139966
24
3048
560