Skip to content

Commit

Permalink
Api test mock registrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben committed Nov 6, 2024
1 parent 4ec6b14 commit 16d2bc2
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions services/121-service/test/mocks/seed-mock.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { TransactionStatusEnum } from '@121-service/src/payments/transactions/enums/transaction-status.enum';
import { SeedScript } from '@121-service/src/scripts/seed-script.enum';
import {
paymentNrVisa,
programIdVisa,
} from '@121-service/src/seed-data/mock/visa-card.data';
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';

describe('Mock registrations', () => {
let accessToken: string;

beforeEach(async () => {
await resetDB(SeedScript.nlrcMultipleMock);
accessToken = await getAccessToken();
});

it('does our mock registration endpoint still work', async () => {
// Arrange
accessToken = await getAccessToken();
// Assert
const registrationsRespnse = await getRegistrations({
programId: programIdVisa,
accessToken,
});
const transactionsResponse = await getTransactions(
programIdVisa,
paymentNrVisa,
null,
accessToken,
);

// Assert
expect(registrationsRespnse.body.length).toBe(4);
expect(transactionsResponse.body.length).toBe(4);
expect(transactionsResponse.text).toContain(TransactionStatusEnum.success);
expect(transactionsResponse.body[0].user).toMatchObject(adminOwnerDto);
});
});

0 comments on commit 16d2bc2

Please sign in to comment.