| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- 'use strict';
- const { expect } = require('chai');
- const { parse, serialize } = require('../../../../xml/register-party/canceled-party-registration');
- const { canceledPartyRegistration1Xml } = require('./xml-responses');
- const { canceledPartyRegistration1 } = require('./js-responses');
- describe('Canceled Party Registration', function() {
- describe('serialize', function() {
- let serializedResponse;
- before(async () => {
- serializedResponse = await serialize(canceledPartyRegistration1);
- });
- it ('successfully serializes valid message', function() {
- expect(serializedResponse).to.eql('<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>');
- });
- });
- describe('parse', function() {
- let parsedResponse;
- before(async () => {
- parsedResponse = await parse(canceledPartyRegistration1Xml);
- });
- it ('successfully parses valid message', function() {
- expect(parsedResponse.responseCode).to.eql('200');
- expect(parsedResponse.responseDescription).to.eql('OK');
- expect(parsedResponse.responseRequestId).to.eql('4323');
- expect(parsedResponse.venId).to.eql('3f59d85fbdf3997dbeb1');
- expect(parsedResponse.registrationId).to.eql('3bd3c02dc6965c8b9240');
- });
- it ('successfully parses serialized value', async function() {
- const serialized = serialize(canceledPartyRegistration1);
- const parsedResponse = await parse(serialized);
- expect(parsedResponse).to.eql(canceledPartyRegistration1);
- });
- });
- });
|