-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding tests for validating the extensions in f2f events (#387)
* Adding tests for validating the extensions in f2f events * Adding tests for validating the extensions in f2f events
- Loading branch information
1 parent
97b11fe
commit 003b1c1
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
tests/regression-tests/ipv_cri_f2f_group_data_validation.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { getQueryResults } from '../helpers/db-helpers'; | ||
import { GET_EVENT_ID, extensionsnotnullquery, IPV_CRI_F2F_DATA } from '../helpers/query-constant'; | ||
import { txmaProcessingWorkGroupName, txmaRawDatabaseName, txmaStageDatabaseName } from '../helpers/envHelper'; | ||
import { eventidlist } from '../helpers/common-helpers'; | ||
|
||
describe('IPV_CRI_F2F GROUP Test - validate data at stage layer', () => { | ||
test.concurrent.each` | ||
eventName | ||
${'F2F_YOTI_RESPONSE_RECEIVED'} | ||
${'IPR_USER_REDIRECTED'} | ||
${'IPR_RESULT_NOTIFICATION_EMAILED'} | ||
`( | ||
'Should validate $eventName event extensions stored in raw and stage layer', | ||
async ({ ...data }) => { | ||
// given | ||
const eventname = data.eventName; | ||
const eventidresults = await getQueryResults( | ||
GET_EVENT_ID(eventname), | ||
txmaStageDatabaseName(), | ||
txmaProcessingWorkGroupName(), | ||
); | ||
const querystring = eventidlist(eventidresults); | ||
const query = `${extensionsnotnullquery(eventname)} and event_id in (${querystring})`; | ||
const athenaQueryResults = await getQueryResults(query, txmaRawDatabaseName(), txmaProcessingWorkGroupName()); | ||
for (let index = 0; index <= athenaQueryResults.length - 1; index++) { | ||
const eventId = athenaQueryResults[index].event_id; | ||
const stExtensions = athenaQueryResults[index].extensions.replace('{', '').replace('}', '').split('=')[1]; | ||
const queryStage = `${IPV_CRI_F2F_DATA(eventname)} and event_id = '${eventId}'`; | ||
const athenaQueryResultsStage = await getQueryResults( | ||
queryStage, | ||
txmaStageDatabaseName(), | ||
txmaProcessingWorkGroupName(), | ||
); | ||
if (stExtensions !== 'null' && stExtensions !== null && stExtensions !== undefined) { | ||
const previousgovuksigninjourneyid = | ||
athenaQueryResultsStage[0].extensions_previousgovuksigninjourneyid.replaceAll('"', ''); | ||
expect(stExtensions).toEqual(previousgovuksigninjourneyid); | ||
} | ||
} | ||
}, | ||
240000, | ||
); | ||
}); |