Skip to content

Commit

Permalink
Test the new registration state change
Browse files Browse the repository at this point in the history
The Jest test was not yet covering the possibility of a registration
timeout
  • Loading branch information
MKodde committed Sep 12, 2024
1 parent b77dc7c commit 5156186
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions assets/typescript/__test__/RegistrationPageService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,28 @@ describe('RegistrationPageService', () => {
});
});

describe('When timeout', () => {
beforeEach(() => {
context.authenticationPageService.start();
if (!statusCallback || !errorCallback) {
throw new Error('Should have started status request');
}
statusCallback(RegistrationStateMachine.TIMEOUT);
});

it('The qr code should be hidden', () => {
expect(context.qrComponent.isVisible()).toBeFalsy();
});

it('Polling should be disabled', () => {
expect(context.pollingService.enabled).toBeFalsy();
});

it('Show finalized', () => {
expect(context.statusUi.showTimeoutHappened).toBeCalled();
});
});

describe('When connection error occurred', () => {
beforeEach(() => {
context.authenticationPageService.start();
Expand Down Expand Up @@ -227,6 +249,7 @@ describe('RegistrationPageService', () => {
showAccountActivationHelp:jest.fn(),
showOneMomentPlease: jest.fn(),
showFinalized: jest.fn(),
showTimeoutHappened: jest.fn(),
showUnknownErrorHappened: jest.fn(),
};

Expand Down

0 comments on commit 5156186

Please sign in to comment.