From 67d74cfa0060d97c948bb747885eaba26294663b Mon Sep 17 00:00:00 2001 From: nanov Date: Wed, 20 Nov 2019 11:12:37 +0200 Subject: [PATCH] test: add more tests --- .editorconfig | 3 + .gitignore | 1 + lib/orders/H004/response.js | 3 +- package.json | 1 + test/fixtures/HPB_response.xml | 21 +++++ test/fixtures/HPB_response_data.xml | 22 +++++ test/fixtures/INI_reposne.xml | 13 +++ test/fixtures/STA_response_part1.xml | 40 ++++++++ test/fixtures/STA_response_part2.xml | 40 ++++++++ test/unit/middlewares.js | 21 +++++ test/unit/responseParser.js | 131 ++++++++++++++++++++------- 11 files changed, 262 insertions(+), 34 deletions(-) create mode 100644 test/fixtures/HPB_response.xml create mode 100644 test/fixtures/HPB_response_data.xml create mode 100644 test/fixtures/INI_reposne.xml create mode 100644 test/fixtures/STA_response_part1.xml create mode 100644 test/fixtures/STA_response_part2.xml create mode 100644 test/unit/middlewares.js diff --git a/.editorconfig b/.editorconfig index 1a8cf57..6165101 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,6 +10,9 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true +[*.xml] +insert_final_newline = false + [*.json] indent_size = 2 diff --git a/.gitignore b/.gitignore index 88c150b..ce3ff63 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ # nyc test coverage .nyc_output +coverage/ # Dependency directories node_modules/ diff --git a/lib/orders/H004/response.js b/lib/orders/H004/response.js index b7344fa..36b6604 100644 --- a/lib/orders/H004/response.js +++ b/lib/orders/H004/response.js @@ -51,7 +51,6 @@ module.exports = (xml, keys) => ({ transactionKey() { const keyNodeText = this.doc.getElementsByTagNameNS('urn:org:ebics:H004', 'TransactionKey')[0].textContent; - return Crypto.privateDecrypt(this.keys.e(), Buffer.from(keyNodeText, 'base64')); }, @@ -64,7 +63,7 @@ module.exports = (xml, keys) => ({ orderId() { const select = xpath.useNamespaces({ xmlns: 'urn:org:ebics:H004' }); - const node = select('//xmlns:header/xmlns:mutable/xmlns:OrderID', this.doc); + const node = select('.//xmlns:header/xmlns:mutable/xmlns:OrderID', this.doc); return node.length ? node[0].textContent : ''; }, diff --git a/package.json b/package.json index e6fb125..7117183 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "scripts": { "lint": "eslint .", "test": "nyc mocha test/**/*.js", + "coverage": "nyc report --reporter=lcov", "version": "auto-changelog -p -t changelog-template.hbs && git add CHANGELOG.md" }, "repository": { diff --git a/test/fixtures/HPB_response.xml b/test/fixtures/HPB_response.xml new file mode 100644 index 0000000..9624105 --- /dev/null +++ b/test/fixtures/HPB_response.xml @@ -0,0 +1,21 @@ + + +
+ + + 000000 + [EBICS_OK] OK + +
+ + + + nuZyAjQoIvH4MwnrCWB82TC/vcNqigpqPtMXwO1Xk9U= + QgfTQqhocARTcpcgySGxn5a+uBuFsHCX0oBINQQIfsgMRR+wEZ3zlXQMUm5GUwwOci2wjkRHJ3PoO4Yd0KzDNWiXFuX/9n00bpnNN5MsTCRgDqJRzZrA1jDxWRBVY/sv3l1gS/ERwyWqub456VZ7DYlXlRA8yp5lormoxftpIt6/Cf0ShmhS8qlUkLYSn/8ugQRl1KRTID5ZSXPjDYAIVZ0izVxblaBYXgs6RH9VvP4uKSn4CFYiFp+alo6EcxFNgMVUnfzaEbsPH/aX9Y3tbdWhATBZSxTT8iMoi2ARhz9VB711aavB8vgzcD6jH3ZtIm+sCb3UC3A/KehEn9GjIA== + + xlQf5zxlUo4LwjkoDsh926OISQwn6PhpxF3CkZI34EO84tfK25zLbqriXiqwDycl2YjYrQxbj8B4k1auNe86a+JigQOoBBCL8gvsoxO+NlziPNzf8sP99dQSp436q7KOhVm4gz2ZZT3D3O5FSqpOKsQ0fJku7D76beoxqxUT+hD0UxgsGLsbGgNLzHPalnFJctuaZtqQmo24Uk6hOwLrFJoQwUbPEffU5GGARWrZVxGQr5Zw4zrtLlZzP1RXk9JZFnhx00KvKiaoxAQXxXUC0BeDM97tIMEiaRNbO3ne+mHtK8vXzc305X5yR0B6ocwbFAmzGQ/e6Fyy6XPIGsbXoLjJGod6ayIU1SJGx/JRyOU4cLkjJZLUQMyCdJ6bA5uYf1AePUDvUA3tAOd6W0cC7DPAlwcrWhSZkPLIawequyjO39LTkEcmINEigd4i3sCrG4e1k303gyIKUg79kApl46onW2vruN3DwswunI10JGXxqex7ccvd2JvD6Pc8cAH1RMg8FIucYd//Joh1XK+QkRdIZMWKg4/lkoWmgVN7ssMmrtsKE2pNFAsIRfgxd8bB64sHZ3XKSyZKTk4LnWdJHZopP/xTs9a+/G3Kd/sIsy4W4sIKZCWU8NL11YOaqfwxY/rYNMaQzhAmawFfWvt74iisFG81Wv+Ijja/dPFmbk3Mup2Dfnlfu26MDblC8+aiaPHypmPuzREqGjW/9d2vtLQz0IXX3X6H4pFXneSjKlwXlDk1WGuiOvXH4gmXEpfWTX9rq+rUyskwwL8ssW5eeeyJ5W2LhVKQllOi/bvrAL5kyrfDMxvOuFIBLxBf//xE + + 000000 + 2016-08-10T16:16:17.512Z + +
\ No newline at end of file diff --git a/test/fixtures/HPB_response_data.xml b/test/fixtures/HPB_response_data.xml new file mode 100644 index 0000000..e520ff3 --- /dev/null +++ b/test/fixtures/HPB_response_data.xml @@ -0,0 +1,22 @@ + + + + + + AJWVHQIfP0H1fr5Y7IjSlDmFksqQ+0E+CjzbEeE6r444LCuSXwbGKF6DJqguyX1qGYxjHRvVtdkNa+GNAtlZnmuPeLHPBUOs5Zx9J5JP4JZOcKd/wnRDIasTkg3NrtZ22tjOrWx26VuR6h7dUH2oJRnFDHmbXoCDMxkqJUNr/TM89p5slJ9Oj5+NAaOzm+7AlwbJ95EI/xc2jEfhp+GdF9CYdS/m2AZaAt79y6QDtBSDdAs0OHTgsOIjbjZkptBF/Gkip2sOordjsChRNLHLDcAOWbsg1NVMuhXs1b6+bCVLXQcGhFydYhqvrXB7pFS0++hlyzqGhbZK5cwEe/v8EJk= + AQAB + + + X002 + + + + + AJWVHQIfP0H1fr5Y7IjSlDmFksqQ+0E+CjzbEeE6r444LCuSXwbGKF6DJqguyX1qGYxjHRvVtdkNa+GNAtlZnmuPeLHPBUOs5Zx9J5JP4JZOcKd/wnRDIasTkg3NrtZ22tjOrWx26VuR6h7dUH2oJRnFDHmbXoCDMxkqJUNr/TM89p5slJ9Oj5+NAaOzm+7AlwbJ95EI/xc2jEfhp+GdF9CYdS/m2AZaAt79y6QDtBSDdAs0OHTgsOIjbjZkptBF/Gkip2sOordjsChRNLHLDcAOWbsg1NVMuhXs1b6+bCVLXQcGhFydYhqvrXB7pFS0++hlyzqGhbZK5cwEe/v8EJk= + AQAB + + + E002 + + CRSISOTB + \ No newline at end of file diff --git a/test/fixtures/INI_reposne.xml b/test/fixtures/INI_reposne.xml new file mode 100644 index 0000000..c798aa9 --- /dev/null +++ b/test/fixtures/INI_reposne.xml @@ -0,0 +1,13 @@ + + + + + B004 + 000000 + [EBICS_OK] OK + + + + 000000 + + diff --git a/test/fixtures/STA_response_part1.xml b/test/fixtures/STA_response_part1.xml new file mode 100644 index 0000000..c12fcca --- /dev/null +++ b/test/fixtures/STA_response_part1.xml @@ -0,0 +1,40 @@ + + +
+ + ECD6F062AAEDFA77250526A68CBEC549 + 2 + + + Initialisation + 1 + 000000 + [EBICS_OK] OK + +
+ + + + + + + + + + OnY4VczV+1XfplpMS/SCKFWn+FDMge40X8TJ9pA6HEI= + + + Qiz8clr/Ym+wLpB8CzTuxKP5rgIR2P4SaX8O4gGZx0Di8Lzd4hsBO3koqIuX11NRZo0RYA5E/IKQCoYLepkcM4QHvLT37YidbrXsTZe6cml/yF8OdyRAcd/9U7AoA9GKENFk4lnBFfZYmM4ADK6wVOCE/ABaOk0NeCDDbxrKA75tfTxwxTvQBfUOHZ87LrZxuQf//L9pzmtI07/7GbsQX8ZceQq40SpBFZn/oRvT/Q38Qu2ZO59MZexJn+BTzlhpfv9fQGF/sgXkdhUkPTEW3nL4j7ehasq3CtySGO2RnEppohEvJ4m07RDtEY3OWyAAZoPFVpvnECM6pOLbIuR40w== + + + + + IUW05JB5cuCzRYYa4kIAZ2ehYVrLI3lKvxZvo1uP+ug= + CPdd6ODXrCxHWpYrwS/5a3NIZ1R2SDscHHJSONc2I7g8ara7qv5Ra7H03W+336DPQLZQxH+EBRWdE2FQ1vrVTcypK6fkFarmO1dEtQt6Ka89AozC7aQMyp4yGl+zlF+XvFkJXZbRXgoEOPsgcG0xM6nKLXnr1ThYRFOoAasigLDGwqxliyhoR94F9dL7YB8Le/uZeRj78mNp4smkE5ZKKyPhwVx+0IW78YuVCSC2c2qbsMmm4evAvycdpLfuuoG4KVlNMIlvkKeBfMZFELcmeKKm85D2zPYkZ7cqG2IfAAp5qdS6K8P7RY4gtjUhOtP5mi8bZt/ZcjioUmIR9dAMnA== + + lJ/v1HvOYAZKTPkxULH4mOcUy01+EaAsxLzCPhtieAo9m5AtU5URdyBVfmclHbtWe3ELb02lR37bChynq0Esqpljxx7CiB+kl/bVs7XkNQQmtGPlh08O7ApJ7AHdKPFFvE+SM2OWpSwUrqJGtmyaU6s+RM66o/3Q0wvKi4y3+Q2jm8nkiWZpPfNt52g4ReE9Ge86o+L+EBOBgZm634L5Z/i6pq908mXBAklPdk1ERdEgWONaOeYYmB70FToplR1gINJEF2CnfAtD/wV+DuQFPDth+EWHqhe3a4xO0d9eJ55ou2QCYOPUC2g/qz1sp7GR74W7P5IWJdmnUEuPFsKJ6OvM+1V8S06jZGDa/QhUGDK8F3G/TMP09W1MsrlQTRr3YQ5H43+pMY7I6Jysze+X9OKZZTTpv4GmYm1USjmraGyMuPF3j9hrlmpttK+1gg2WzytCJO44YsZp9ckls8JNK4bT5uwTuomKZoRgmiIOTcMh4VP7V28TWj2XdF+T6rBFILTvQyXMOzvbe1kLwg2O31JDBdJ8X1fHCYJxKsIrYCSDPz4sha8h7QmHrCSFmjoXb+LUElnbLXZVRkY5/Dc73EM6Es3wAgjwSJK2asRqdqU0PhbS5qpIlgYKsNcb+Wes + + 000000 + 2013-12-09T15:14:30.000Z + +
diff --git a/test/fixtures/STA_response_part2.xml b/test/fixtures/STA_response_part2.xml new file mode 100644 index 0000000..d0431b1 --- /dev/null +++ b/test/fixtures/STA_response_part2.xml @@ -0,0 +1,40 @@ + + +
+ + ECD6F062AAEDFA77250526A68CBEC549 + 1 + + + Initialisation + 1 + 000000 + [EBICS_OK] OK + +
+ + + + + + + + + + OnY4VczV+1XfplpMS/SCKFWn+FDMge40X8TJ9pA6HEI= + + + Qiz8clr/Ym+wLpB8CzTuxKP5rgIR2P4SaX8O4gGZx0Di8Lzd4hsBO3koqIuX11NRZo0RYA5E/IKQCoYLepkcM4QHvLT37YidbrXsTZe6cml/yF8OdyRAcd/9U7AoA9GKENFk4lnBFfZYmM4ADK6wVOCE/ABaOk0NeCDDbxrKA75tfTxwxTvQBfUOHZ87LrZxuQf//L9pzmtI07/7GbsQX8ZceQq40SpBFZn/oRvT/Q38Qu2ZO59MZexJn+BTzlhpfv9fQGF/sgXkdhUkPTEW3nL4j7ehasq3CtySGO2RnEppohEvJ4m07RDtEY3OWyAAZoPFVpvnECM6pOLbIuR40w== + + + + + IUW05JB5cuCzRYYa4kIAZ2ehYVrLI3lKvxZvo1uP+ug= + CPdd6ODXrCxHWpYrwS/5a3NIZ1R2SDscHHJSONc2I7g8ara7qv5Ra7H03W+336DPQLZQxH+EBRWdE2FQ1vrVTcypK6fkFarmO1dEtQt6Ka89AozC7aQMyp4yGl+zlF+XvFkJXZbRXgoEOPsgcG0xM6nKLXnr1ThYRFOoAasigLDGwqxliyhoR94F9dL7YB8Le/uZeRj78mNp4smkE5ZKKyPhwVx+0IW78YuVCSC2c2qbsMmm4evAvycdpLfuuoG4KVlNMIlvkKeBfMZFELcmeKKm85D2zPYkZ7cqG2IfAAp5qdS6K8P7RY4gtjUhOtP5mi8bZt/ZcjioUmIR9dAMnA== + + lJ/v1HvOYAZKTPkxULH4mOcUy01+EaAsxLzCPhtieAo9m5AtU5URdyBVfmclHbtWe3ELb02lR37bChynq0Esqpljxx7CiB+kl/bVs7XkNQQmtGPlh08O7ApJ7AHdKPFFvE+SM2OWpSwUrqJGtmyaU6s+RM66o/3Q0wvKi4y3+Q2jm8nkiWZpPfNt52g4ReE9Ge86o+L+EBOBgZm634L5Z/i6pq908mXBAklPdk1ERdEgWONaOeYYmB70FToplR1gINJEF2CnfAtD/wV+DuQFPDth+EWHqhe3a4xO0d9eJ55ou2QCYOPUC2g/qz1sp7GR74W7P5IWJdmnUEuPFsKJ6OvM+1V8S06jZGDa/QhUGDK8F3G/TMP09W1MsrlQTRr3YQ5H43+pMY7I6Jysze+X9OKZZTTpv4GmYm1USjmraGyMuPF3j9hrlmpttK+1gg2WzytCJO44YsZp9ckls8JNK4bT5uwTuomKZoRgmiIOTcMh4VP7V28TWj2XdF+T6rBFILTvQyXMOzvbe1kLwg2O31JDBdJ8X1fHCYJxKsIrYCSDPz4sha8h7QmHrCSFmjoXb+LUElnbLXZVRkY5/Dc73EM6Es3wAgjwSJK2asRqdqU0PhbS5qpIlgYKsNcb+Wes + + 000000 + 2013-12-09T15:14:30.000Z + +
diff --git a/test/unit/middlewares.js b/test/unit/middlewares.js new file mode 100644 index 0000000..ea7e28f --- /dev/null +++ b/test/unit/middlewares.js @@ -0,0 +1,21 @@ +'use strict'; + +/* eslint-env node, mocha */ + +const { assert } = require('chai'); + +const response = require('../../lib/middleware/response'); +const serializer = require('../../lib/middleware/serializer'); +const signer = require('../../lib/middleware/signer'); + +describe('Middlewares', () => { + describe('Response Middleware', () => { + it('should throw with no unspported protocol version', () => assert.throws(() => response('H003'))); + }); + describe('Signer Middleware', () => { + it('should throw with no unspported protocol version', () => assert.throws(() => signer('H003'))); + }); + describe('Signer Middleware', () => { + it('should throw with no unspported protocol version', () => assert.throws(() => serializer('H003'))); + }); +}); diff --git a/test/unit/responseParser.js b/test/unit/responseParser.js index 6d65034..d9b6564 100644 --- a/test/unit/responseParser.js +++ b/test/unit/responseParser.js @@ -2,44 +2,111 @@ /* eslint-env node, mocha */ +const { readFileSync } = require('fs'); +const { join, resolve } = require('path'); + const { assert } = require('chai'); + const H004Response = require('../../lib/orders/H004/response'); +const ebics = require('../../'); + + +const client = new ebics.Client({ + url: 'https://iso20022test.credit-suisse.com/ebicsweb/ebicsweb', + partnerId: 'CRS04381', + userId: 'CRS04381', + hostId: 'CRSISOTB', + passphrase: 'test', + keyStorage: ebics.fsKeysStorage(resolve(__dirname, '../support/TEST_KEYS.key')), +}); + +const buildResponse = (xmlPath) => { + const response = H004Response('', {}); + const xml = readFileSync(xmlPath, { encoding: 'utf8' }); + response.orderData = () => xml; + return response; +}; + +const fixtures = { + HPB: async () => H004Response(readFileSync(join(__dirname, '../fixtures/HPB_response.xml'), { encoding: 'utf8' }), await client.keys()), + HPB_DATA: () => buildResponse(join(__dirname, '../fixtures/HPB_response_data.xml')), + INI: () => H004Response(readFileSync(join(__dirname, '../fixtures/INI_reposne.xml'), { encoding: 'utf8' }), client.keys()), + STA_1: () => H004Response(readFileSync(join(__dirname, '../fixtures/STA_response_part1.xml'), { encoding: 'utf8' }), client.keys()), + STA_2: () => H004Response(readFileSync(join(__dirname, '../fixtures/STA_response_part2.xml'), { encoding: 'utf8' }), client.keys()), + x002mod: 'AJWVHQIfP0H1fr5Y7IjSlDmFksqQ+0E+CjzbEeE6r444LCuSXwbGKF6DJqguyX1qGYxjHRvVtdkNa+GNAtlZnmuPeLHPBUOs5Zx9J5JP4JZOcKd/wnRDIasTkg3NrtZ22tjOrWx26VuR6h7dUH2oJRnFDHmbXoCDMxkqJUNr/TM89p5slJ9Oj5+NAaOzm+7AlwbJ95EI/xc2jEfhp+GdF9CYdS/m2AZaAt79y6QDtBSDdAs0OHTgsOIjbjZkptBF/Gkip2sOordjsChRNLHLDcAOWbsg1NVMuhXs1b6+bCVLXQcGhFydYhqvrXB7pFS0++hlyzqGhbZK5cwEe/v8EJk=', + e002mod: 'AJWVHQIfP0H1fr5Y7IjSlDmFksqQ+0E+CjzbEeE6r444LCuSXwbGKF6DJqguyX1qGYxjHRvVtdkNa+GNAtlZnmuPeLHPBUOs5Zx9J5JP4JZOcKd/wnRDIasTkg3NrtZ22tjOrWx26VuR6h7dUH2oJRnFDHmbXoCDMxkqJUNr/TM89p5slJ9Oj5+NAaOzm+7AlwbJ95EI/xc2jEfhp+GdF9CYdS/m2AZaAt79y6QDtBSDdAs0OHTgsOIjbjZkptBF/Gkip2sOordjsChRNLHLDcAOWbsg1NVMuhXs1b6+bCVLXQcGhFydYhqvrXB7pFS0++hlyzqGhbZK5cwEe/v8EJk=', +}; + describe('H004 response parsing', () => { it('parses bank keys', () => { - const response = H004Response('', {}); - - const x002mod = 'ntbX6WFjAJP5RyH4ogDG/26wZGzEJXsTudyvcgXmUdk1AExCNqArXDiSlGXpVNq4BKddUMFUmVOyvkdNckPRV2mk3uHNCE5T3tFKQI3FlwHSJHvPSpb9gtHnsK03jByMigWjhTKvsjIdfLVay5m5Bctxq9+5JMHwlNk7MlVXBQcqaFiHFFS1lPfA3Wk1bptPeeGyYcP0+U798oQWnCABKwS8hmYcp5xBtozGoRj9L/NDE68pdP8o/wTKNwT4Jo5nQKYfDsgO4R+z9vVv37Htp6bWhK8Jw3tpkcd3JnkYWx+Ylg0XBpg8LfjFhY2Jc7FqLlx0Bn0Y3PRLI1apxgC85w=='; - const e002mod = '4eOGrzcJHVzbEgZTmyPYUIq9kFoua8Ure1Mvyq6XlawFgCWskfu/xSKNLIMJ7H675wl/5y0Oy16P/b6pJEhWrzOw8omW46PBDTaXw9BDYBTuBblluz1yUnzpgfblP8gkRmxAo+QMIskmwdSzuZMiJcLNSzu/bkmLHK2RdrVYMAZLlB6QXTykdenPZtNmc2z4VU6TRmGljAwg2VUNF6iQoucbzDUuca+yUo3fiXZp69nfXv81X2ND+p1ir6zQpx7tbOdfauw0sEKI/Z/lC+E4fMrMlh/ZvOxSYUMA55J4liC3aUV3mTR3dPJHWu1aD1a7EfJnNw0eHLwlB+36qfgGuw=='; - - response.orderData = () => ` - - - - - ${x002mod} - AQAB - - 2015-02-25T08:01:13.061Z - - X002 - - - - - ${e002mod} - AQAB - - 2015-02-25T08:01:12.344Z - - E002 - - SBKPR01 - `; - + const response = fixtures.HPB_DATA(); const bankKeys = response.bankKeys(); - assert.equal(bankKeys.bankX002.mod.toString('base64'), x002mod); - assert.equal(bankKeys.bankE002.mod.toString('base64'), e002mod); + assert.equal(bankKeys.bankX002.mod.toString('base64'), fixtures.x002mod); + assert.equal(bankKeys.bankE002.mod.toString('base64'), fixtures.e002mod); }); + + it('detects unsegmented response', () => { + const response = fixtures.HPB_DATA(); + assert.equal(response.isSegmented(), false); + assert.equal(response.isLastSegment(), false); + }); + + it('detects segmented response', () => { + const responsePart1 = fixtures.STA_1(); + const responsePart2 = fixtures.STA_2(); + assert.equal(responsePart1.isSegmented(), true); + assert.equal(responsePart1.isLastSegment(), false); + assert.equal(responsePart2.isSegmented(), true); + assert.equal(responsePart2.isLastSegment(), true); + }); + + it('parses OrderID', () => { + const response = fixtures.INI(); + assert.equal(response.orderId(), 'B004'); + }); + + it('parses BuissnessCode', () => { + const response = fixtures.INI(); + const code = response.businessCode(); + assert.equal(code, '000000'); + assert.equal(response.businessSymbol(code), 'EBICS_OK'); + assert.equal(response.businessMeaning(code), 'No technical errors occurred during processing of the EBICS request'); + assert.equal(response.businessShortText(code), 'OK'); + }); + + it('parses TechnicalCode', () => { + const response = fixtures.INI(); + const code = response.technicalCode(); + assert.equal(code, '000000'); + assert.equal(response.technicalSymbol(code), '[EBICS_OK] OK'); + assert.equal(response.technicalMeaning(code), 'No technical errors occurred during processing of the EBICS request'); + assert.equal(response.technicalShortText(code), 'OK'); + }); + + it('parses TransactionID', () => { + const response = fixtures.STA_1(); + const code = response.transactionId(); + assert.equal(code, 'ECD6F062AAEDFA77250526A68CBEC549'); + }); + + it('parses TransactionKey', async () => { + const response = await fixtures.HPB(); + const code = response.transactionKey().toString('base64'); + assert.equal(code, '2OTepxiy49uayuzZlYFf8Q=='); + }); + + it('parses OrderData', async () => { + const response = await fixtures.HPB(); + const orderBuffer = response.orderData(); + assert.deepEqual(orderBuffer, readFileSync(join(__dirname, '../fixtures/HPB_response_data.xml'))); + }); + + it('generates XML', async () => { + const response = await fixtures.HPB(); + const xmlString = response.toXML().replace('\\n', '\n'); + assert.deepEqual(xmlString, readFileSync(join(__dirname, '../fixtures/HPB_response.xml'), { encoding: 'utf8' })); + }); + });