Commits

Torben Cortnum Jørgensen authored and Louise Kelstrup committed 46f411016fb Merge
SD-2101: Tilføjet DROS valideringsfixtures

Merge in NT/nsp-regressionstest from SD-2101 to master * commit 'dc550613bb120429acb268c6772f4c6351e3edab': Tilføjet 2 fixtures til validering af DROS Har tilføjet 2 nye test fixtures, til validering af dros svar
No tags

cucumber/fixtures/services/dros.js

Modified
28 28 // Getting the status from the last response
29 29 if (this.getLastResponse().body.response.main.Envelope.Body.RegistryResponse == undefined) {
30 30 console.log(this.getLastResponse().body.response.main.Envelope.Body);
31 31 this.attach((JSON.stringify(this.getLastResponse().body.response.main.Envelope.Body)));
32 32 throw new Error('Der er ingen Registry Response');
33 33 }
34 34 else {
35 35 let response =
36 36 this.getLastResponse().body.response.main.Envelope.Body.RegistryResponse
37 37 .__status;
38 -
39 38 // Expecting the status from the response status to equal the status from the fixture
40 39 // Note: The status is either 'Success' or 'Failure', which both are 7 letters. Therefore this fixture only works when the status is 7 letters
41 40 expect(response.substring(response.length - 7)).to.equal(Status);
42 41 };
43 42 });
44 43
45 44 // This fixture expects the DROS failure message to equal the given failure message
46 45 Then('DROS fejltekst er {string}', function (failureMessage) {
47 46 // Getting the failure message from the last response
48 47 let failureResponse =
366 365 case '103140-0':
367 366 repositoryId = '1.2.208.176.43210.8.10.14'
368 367 break;
369 368 default:
370 369 throw new Error('Document type not found: ' + this.typeCode);
371 370 }
372 371 const response = await getDDSRepositoryGeneric(this.attach, cpr, id, repositoryId);
373 372 this.variables.set(ResultName, response);
374 373 this.responses.push(response)
375 374 });
375 +
376 +Then(
377 + 'DROS reply indeholder validering {string}',
378 + async function (validate) {
379 + if(this.getLastResponse().body.response.main.Envelope.Body.RegistryResponse.RegistryErrorList != undefined){
380 + const errors = this.getLastResponse().body.response.main.Envelope.Body.RegistryResponse.RegistryErrorList.RegistryError;
381 +
382 + var containsValidate = false;
383 +
384 + for (const error of errors) {
385 + if (error.__codeContext == (validate)) {
386 + containsValidate = true;
387 + break;
388 + }
389 + }
390 + if (!containsValidate){throw new Error("Forventede validering men kunne ikke finde fejl i errorlist");}
391 + }
392 + else {throw new Error("Forventede validering men der var ikke noget");}
393 +
394 + }
395 +);
396 +
397 +// The fixture expects the gender to not be validated
398 +
399 +Then('DROS reply indeholder ikke validering {string}', async function (validate) {
400 + if(this.getLastResponse().body.response.main.Envelope.Body.RegistryResponse.RegistryErrorList != undefined){
401 + const errors = this.getLastResponse().body.response.main.Envelope.Body.RegistryResponse.RegistryErrorList.RegistryError;
402 + for (const error of errors) {
403 + console.log(error.__codeContext);
404 + if (error.__codeContext == (validate)) {throw new Error("Fejlen var i errorlisten");}
405 + }
406 + }
407 + }
408 +);

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut