-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Api test mock registrations * Apply suggestions from code review --------- Co-authored-by: Ruben <vandervalk@geoit.nl> Co-authored-by: jannisvisser <jannisvisser@redcross.nl>
- Loading branch information
1 parent
fd9587f
commit 91ed6cc
Showing
1 changed file
with
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { TransactionStatusEnum } from '@121-service/src/payments/transactions/enums/transaction-status.enum'; | ||
import { SeedScript } from '@121-service/src/scripts/seed-script.enum'; | ||
import { adminOwnerDto } from '@121-service/test/fixtures/user-owner'; | ||
import { getTransactions } from '@121-service/test/helpers/program.helper'; | ||
import { getRegistrations } from '@121-service/test/helpers/registration.helper'; | ||
import { | ||
getAccessToken, | ||
resetDB, | ||
} from '@121-service/test/helpers/utility.helper'; | ||
import { | ||
programIdOCW, | ||
programIdPV, | ||
} from '@121-service/test/registrations/pagination/pagination-data'; | ||
|
||
describe('Mock registrations', () => { | ||
it('does mock nlrc multiple still seed registrations and transactions', async () => { | ||
// Arrange | ||
await resetDB(SeedScript.nlrcMultipleMock); | ||
const accessToken = await getAccessToken(); | ||
const payment = 1; | ||
// Assert | ||
const programs = [ | ||
{ programId: programIdOCW, paymentNr: payment }, | ||
{ programId: programIdPV, paymentNr: payment }, | ||
]; | ||
|
||
for (const { programId, paymentNr } of programs) { | ||
const registrationsResponse = await getRegistrations({ | ||
programId, | ||
accessToken, | ||
}); | ||
|
||
const transactionsResponse = await getTransactions( | ||
programId, | ||
paymentNr, | ||
null, | ||
accessToken, | ||
); | ||
|
||
// Assert | ||
expect(registrationsResponse.body.data.length).toBe(4); | ||
expect(transactionsResponse.body.length).toBe(4); | ||
expect(transactionsResponse.text).toContain( | ||
TransactionStatusEnum.success, | ||
); | ||
expect(transactionsResponse.body[0].user).toMatchObject(adminOwnerDto); | ||
} | ||
}); | ||
}); |