Files
shields/services/dynamic/dynamic-xml.spec.js
Caleb Cartwright 65f66642dd fix type errors in [DynamicXml] service (#4041)
* fix: type errors in DynamicXml service

* tests: add more tests for DynamicXml

* tests: another DynamicXml service test
2019-10-08 15:48:43 -05:00

32 lines
818 B
JavaScript

'use strict'
const { expect } = require('chai')
const sinon = require('sinon')
const xpath = require('xpath')
const { exampleXml } = require('./dynamic-response-fixtures')
const DynamicXml = require('./dynamic-xml.service')
const { InvalidResponse } = require('..')
describe('DynamicXml', function() {
describe('transform()', function() {
beforeEach(function() {
sinon.stub(xpath, 'select').returns(undefined)
})
afterEach(function() {
sinon.restore()
})
it('throws InvalidResponse on unsupported query', function() {
expect(() =>
DynamicXml.prototype.transform({
pathExpression: '//book/title',
buffer: exampleXml,
})
)
.to.throw(InvalidResponse)
.with.property('prettyMessage', 'unsupported query')
})
})
})