Socket
Socket
Sign inDemoInstall

soap

Package Overview
Dependencies
Maintainers
4
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

soap - npm Package Compare versions

Comparing version 0.10.0 to 0.10.1

soap-stub.js

4

History.md

@@ -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 @@ =================

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc