Skip to content

Commit

Permalink
fixed tests with right wsdl
Browse files Browse the repository at this point in the history
  • Loading branch information
schaechinger committed Mar 24, 2018
1 parent c8b584c commit a65ea2a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 20 deletions.
13 changes: 8 additions & 5 deletions lib/Internetmarke.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,22 @@ class Internetmarke {
}

/**
* Add another voucher to the order list.
* Add another voucher to the order list. At least the product or the
* productCode and it's current price must be given!
*
* @param {Object} position
* @param {number} position.productCode - The product code of the voucher.
* @param {number} position.price - The price of the product that should be
* @param {Product} [position.product] - The product that should be ordered.
* @param {number} [position.productCode] - The product code of the voucher.
* @param {number} [position.price] - The price of the product that should be
* order for security reasons.
* @param {string} [position.voucherLayout] - The layout of the voucher.
* @param {AddressBinding} [position.addressBinding] - The pair of addresses
* if available. This is only possible for AddressZone layout.
* @returns {Internetmarke}
*/
orderVoucher({ productCode, price, voucherLayout = this._config.voucherLayout,
orderVoucher({ product = null, productCode = 0, price = 0, voucherLayout = this._config.voucherLayout,
addressBinding = null }) {
this._order.addPosition({ productCode, voucherLayout, price, addressBinding });
this._order.addPosition({ product, productCode, voucherLayout, price, addressBinding });

return this;
}
Expand Down Expand Up @@ -130,6 +132,7 @@ class Internetmarke {
}

/**
* Enables the product service to make use of the product database at checkout.
*
* @param {Object} data
* @param {Client} data.client - The credentials of the client registered for
Expand Down
14 changes: 14 additions & 0 deletions test/Service/Soap/Product.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const ProductService = require('../../../lib/Service/Soap/Product');

const CLIENT_STUB = require('../../stub/client');

xdescribe('SOAP Product Service', () => {
it('should load the product list', (done) => {
const service = new ProductService({ client: CLIENT_STUB.client, forceLoad: false });

service.getProductList()
.then(() => {
done();
});
});
});
2 changes: 1 addition & 1 deletion test/Service/Soap/Soap.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Soap Service', () => {
});

it('should create a new client if not existing', done => {
const service = new SoapService({ wsdl: WSDL.OneClickForApp });
const service = new SoapService({ wsdl: WSDL.ONECLICKFORAPP });

service._getSoapClient()
.then(client => {
Expand Down
14 changes: 0 additions & 14 deletions test/Service/SoapProductService.test.js

This file was deleted.

16 changes: 16 additions & 0 deletions test/stub/client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const response = {
getUsername: 'CLIENT_USER',
getPassword: 'CLIENT_PASS',
getId: 'MANDANT_ID'
};

const client = {
getUsername: sinon.stub().returns(response.getUsername),
getPassword: sinon.stub().returns(response.getPassword),
getId: sinon.stub().returns(response.getId)
};

module.exports = {
client,
response
};

0 comments on commit a65ea2a

Please sign in to comment.