cancel-party-registration.spec.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. 'use strict';
  2. const { expect } = require('chai');
  3. const {
  4. parse,
  5. serialize,
  6. } = require('../../../../xml/register-party/cancel-party-registration');
  7. const { cancelPartyRegistration1Xml } = require('./xml-requests');
  8. const { cancelPartyRegistration1 } = require('./js-requests');
  9. describe('Cancel Party Registration', function() {
  10. describe('parse', function() {
  11. let parsedResponse;
  12. before(async () => {
  13. parsedResponse = await parse(cancelPartyRegistration1Xml);
  14. });
  15. it('successfully parses valid message', function() {
  16. expect(parsedResponse.venId).to.eql('3f59d85fbdf3997dbeb1');
  17. expect(parsedResponse.registrationId).to.eql('3bd3c02dc6965c8b9240');
  18. });
  19. it('successfully parses serialized value', async function() {
  20. const serialized = serialize(cancelPartyRegistration1);
  21. const parsedResponse = await parse(serialized);
  22. expect(parsedResponse).to.eql(cancelPartyRegistration1);
  23. });
  24. });
  25. describe('serialize', function() {
  26. let serializedResponse;
  27. before(async () => {
  28. serializedResponse = await serialize(cancelPartyRegistration1);
  29. });
  30. it('successfully serializes valid message', function() {
  31. expect(serializedResponse).to.eql(
  32. '<oadr2b:oadrPayload xmlns:oadr2b="http://openadr.org/oadr-2.0b/2012/07"><oadr2b:oadrSignedObject><oadr2b:oadrCancelPartyRegistration xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110" ei:schemaVersion="2.0b"><pyld:requestID xmlns:pyld="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">223344</pyld:requestID><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:oadrCancelPartyRegistration></oadr2b:oadrSignedObject></oadr2b:oadrPayload>',
  33. );
  34. });
  35. });
  36. });