canceled-party-registration.spec.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. 'use strict';
  2. const { expect } = require('chai');
  3. const {
  4. parse,
  5. serialize,
  6. } = require('../../../../xml/register-party/canceled-party-registration');
  7. const { canceledPartyRegistration1Xml } = require('./xml-responses');
  8. const { canceledPartyRegistration1 } = require('./js-responses');
  9. describe('Canceled Party Registration', function() {
  10. describe('serialize', function() {
  11. let serializedResponse;
  12. before(async () => {
  13. serializedResponse = await serialize(canceledPartyRegistration1);
  14. });
  15. it('successfully serializes valid message', function() {
  16. expect(serializedResponse).to.eql(
  17. '<oadr2b:oadrPayload xmlns:oadr2b="http://openadr.org/oadr-2.0b/2012/07"><oadr2b:oadrSignedObject><oadr2b:oadrCanceledPartyRegistration xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110" ei:schemaVersion="2.0b"><ei:eiResponse xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110"><ei:responseCode>200</ei:responseCode><ei:responseDescription>OK</ei:responseDescription><pyld:requestID xmlns:pyld="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">334455</pyld:requestID></ei:eiResponse><ei:registrationID xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">3bd3c02dc6965c8b9240</ei:registrationID><ei:venID xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110">3f59d85fbdf3997dbeb1</ei:venID></oadr2b:oadrCanceledPartyRegistration></oadr2b:oadrSignedObject></oadr2b:oadrPayload>',
  18. );
  19. });
  20. });
  21. describe('parse', function() {
  22. let parsedResponse;
  23. before(async () => {
  24. parsedResponse = await parse(canceledPartyRegistration1Xml);
  25. });
  26. it('successfully parses valid message', function() {
  27. expect(parsedResponse.responseCode).to.eql('200');
  28. expect(parsedResponse.responseDescription).to.eql('OK');
  29. expect(parsedResponse.responseRequestId).to.eql('4323');
  30. expect(parsedResponse.venId).to.eql('3f59d85fbdf3997dbeb1');
  31. expect(parsedResponse.registrationId).to.eql('3bd3c02dc6965c8b9240');
  32. });
  33. it('successfully parses serialized value', async function() {
  34. const serialized = serialize(canceledPartyRegistration1);
  35. const parsedResponse = await parse(serialized);
  36. expect(parsedResponse).to.eql(canceledPartyRegistration1);
  37. });
  38. });
  39. });