Skip to content

Commit 0afdd6f

Browse files
ANMC20abhinavqtnhs
andauthored
test: epic 3 transformation - invalid flag triggers reason for removal (#959)
* Transformation - Invalid Flag triggers Reason for Removal * test: fix tag for functional test * test: chore added requirement link which is being tested * test: check invalid flag triggers reason for removal logic * test: chore use hooks for setup and add test step for validation * test: remove only flag from the test --------- Co-authored-by: Abhinav S <[email protected]>
1 parent d9c2ff6 commit 0afdd6f

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { test } from '../../fixtures/test-fixtures';
2+
import { TestHooks } from '../../hooks/test-hooks';
3+
import { validateSqlDatabaseFromAPI } from "../../steps/steps";
4+
5+
6+
test.describe('@regression @e2e @epic3-high-priority Tests', () => {
7+
8+
TestHooks.setupAddTestHooks();
9+
10+
test('@DTOSS-6326-01 - Transformation - Invalid Flag triggers Reason for Removal logic - should apply correct transformations when invalidFlag is true', {
11+
annotation: {
12+
type: 'Requirement',
13+
description: 'Tests - https://nhsd-jira.digital.nhs.uk/browse/DTOSS-5396',
14+
},
15+
}, async ({ request, testData }) => {
16+
17+
await test.step('Then Reason for Removal is set to ORR, Primary Care Provider to null, and Reason for Removal Date to todays date', async () => {
18+
let checkInDatabaseRunTime = testData.checkInDatabase;
19+
checkInDatabaseRunTime = checkInDatabaseRunTime.map((record: any) => {
20+
if (record.validations.ReasonForRemovalDate) {
21+
record.validations.ReasonForRemovalDate = new Date().toISOString().split("T")[0] + "T00:00:00";
22+
}
23+
return record;
24+
});
25+
await validateSqlDatabaseFromAPI(request, checkInDatabaseRunTime);
26+
});
27+
});
28+
});
29+
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"validations": [
3+
{
4+
"validations": {
5+
"apiEndpoint": "api/CohortDistributionDataService",
6+
"NHSNumber": 9992728167,
7+
"ReasonForRemoval":"ORR",
8+
"PrimaryCareProvider":"",
9+
"ReasonForRemovalDate":"updateAtRunTimeValueForTodaysDate"
10+
}
11+
},
12+
{
13+
"validations": {
14+
"apiEndpoint": "api/ParticipantDemographicDataService",
15+
"NhsNumber": 9992728167,
16+
"expectedCount": 1
17+
}
18+
},
19+
{
20+
"validations": {
21+
"apiEndpoint": "api/ParticipantManagementDataService",
22+
"RecordType": "ADD",
23+
"NHSNumber": 9992728167,
24+
"expectedCount": 1
25+
}
26+
}
27+
],
28+
"inputParticipantRecord": [
29+
{
30+
"record_type": "ADD",
31+
"change_time_stamp": null,
32+
"serial_change_number": 98,
33+
"nhs_number": 9992728167,
34+
"superseded_by_nhs_number": null,
35+
"primary_care_provider": "A81623",
36+
"primary_care_effective_from_date": "20030318",
37+
"current_posting": "LA",
38+
"current_posting_effective_from_date": "20130319",
39+
"name_prefix": "BRO",
40+
"given_name": "Invalid Flag True",
41+
"other_given_name": "OtherGivenName 98",
42+
"family_name": "FamiliyName 98",
43+
"previous_family_name": "PreviousFamilyName 98",
44+
"date_of_birth": "19700101",
45+
"gender": 2,
46+
"address_line_1": "98 Spaight Road",
47+
"address_line_2": "Eastbourne",
48+
"address_line_3": "TestAddress",
49+
"address_line_4": "Chelmsford",
50+
"address_line_5": "United Kingdom",
51+
"postcode": "AL1 8FJ",
52+
"paf_key": "Z3S4Q5X9",
53+
"address_effective_from_date": "20130319",
54+
"reason_for_removal": null,
55+
"reason_for_removal_effective_from_date": null,
56+
"date_of_death": null,
57+
"death_status": null,
58+
"home_telephone_number": "01619999999",
59+
"home_telephone_effective_from_date": "20200818",
60+
"mobile_telephone_number": "07888888888",
61+
"mobile_telephone_effective_from_date": "20200818",
62+
"email_address": "[email protected]",
63+
"email_address_effective_from_date": "20200818",
64+
"preferred_language": "en",
65+
"is_interpreter_required": false,
66+
"invalid_flag": true,
67+
"eligibility": true
68+
}
69+
],
70+
"nhsNumbers": [
71+
"9992728167"
72+
]
73+
}

0 commit comments

Comments
 (0)