parser.spec.js 996 B

12345678910111213141516171819202122
  1. 'use strict';
  2. const { expect } = require('chai');
  3. const { parseXML } = require('../../../xml/parser');
  4. describe('Parser', function() {
  5. describe('parseXML', function() {
  6. it('throws Error on malformed input', async function() {
  7. let lastError;
  8. try {
  9. await parseXML(`<oadr2b:oadrPayload xmlns:oadr2b="http://openadr.org/oadr-2.0b/2012/07" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110" xmlns:emix="http://docs.oasis-open.org/ns/emix/2011/06" xmlns:pyld="http://docs.oasis-open.org/ns/energyinterop/201110/payloads" xmlns:power="http://docs.oasis-open.org/ns/emix/2011/06/power" xmlns:scale="http://docs.oasis-open.org/ns/emix/2011/06/siscale" xmlns:xcal="urn:ietf:params:xml:ns:icalendar-2.0" xmlns:strm="urn:ietf:params:xml:ns:icalendar-2.0:stream">
  10. <oadr2b:oadrSignedObject>
  11. <oadr2b:oadrCreatePartyRegistration ei:schemaVersion="2.0b">`);
  12. } catch (e) {
  13. lastError = e;
  14. }
  15. expect(lastError).to.be.an('error');
  16. });
  17. });
  18. });