fix: Remove interaction details from IdpRenderHandler

This commit is contained in:
Joachim Van Herwegen
2021-05-26 14:14:52 +02:00
parent 6bfe1bdccc
commit 998d2f49e1
11 changed files with 24 additions and 51 deletions

View File

@@ -16,10 +16,8 @@ describe('A ForgotPasswordHandler', (): void => {
const email = 'test@test.email';
const recordId = '123456';
const html = `<a href="/base/idp/resetpassword?rid=${recordId}">Reset Password</a>`;
// `Interaction` type is not exposed
const details = {} as any;
const renderParams = { response, props: { details, errorMessage: '', prefilled: { email }}};
let provider: Provider;
const renderParams = { response, props: { errorMessage: '', prefilled: { email }}};
const provider: Provider = {} as any;
let messageRenderHandler: IdpRenderHandler;
let accountStore: AccountStore;
const baseUrl = 'http://test.com/base/';
@@ -31,10 +29,6 @@ describe('A ForgotPasswordHandler', (): void => {
beforeEach(async(): Promise<void> => {
request = createPostFormRequest({ email });
provider = {
interactionDetails: jest.fn().mockResolvedValue(details),
} as any;
messageRenderHandler = {
handleSafe: jest.fn(),
} as any;

View File

@@ -11,9 +11,7 @@ import type { HttpResponse } from '../../../../../src/server/HttpResponse';
describe('An IdpRouteController', (): void => {
let request: HttpRequest;
const response: HttpResponse = {} as any;
// `Interaction` type is not exposed
const details = {} as any;
let provider: Provider;
const provider: Provider = {} as any;
let renderHandler: IdpRenderHandler;
let postHandler: HttpHandler;
let controller: IdpRouteController;
@@ -24,10 +22,6 @@ describe('An IdpRouteController', (): void => {
method: 'GET',
} as any;
provider = {
interactionDetails: jest.fn().mockResolvedValue(details),
} as any;
renderHandler = {
handleSafe: jest.fn(),
} as any;
@@ -44,7 +38,7 @@ describe('An IdpRouteController', (): void => {
expect(renderHandler.handleSafe).toHaveBeenCalledTimes(1);
expect(renderHandler.handleSafe).toHaveBeenLastCalledWith({
response,
props: { details, errorMessage: '', prefilled: {}},
props: { errorMessage: '', prefilled: {}},
});
expect(postHandler.handleSafe).toHaveBeenCalledTimes(0);
});
@@ -67,7 +61,7 @@ describe('An IdpRouteController', (): void => {
expect(renderHandler.handleSafe).toHaveBeenCalledTimes(1);
expect(renderHandler.handleSafe).toHaveBeenLastCalledWith({
response,
props: { details, errorMessage: 'bad request!', prefilled: { more: 'data!' }},
props: { errorMessage: 'bad request!', prefilled: { more: 'data!' }},
});
});
@@ -80,7 +74,7 @@ describe('An IdpRouteController', (): void => {
expect(renderHandler.handleSafe).toHaveBeenCalledTimes(1);
expect(renderHandler.handleSafe).toHaveBeenLastCalledWith({
response,
props: { details, errorMessage: 'An unknown error occurred', prefilled: {}},
props: { errorMessage: 'An unknown error occurred', prefilled: {}},
});
});

View File

@@ -36,7 +36,6 @@ describe('An InitialInteractionHandler', (): void => {
expect(map.test.handleSafe).toHaveBeenLastCalledWith({
response,
props: {
details,
errorMessage: '',
prefilled: {},
},
@@ -53,7 +52,6 @@ describe('An InitialInteractionHandler', (): void => {
expect(map.default.handleSafe).toHaveBeenLastCalledWith({
response,
props: {
details,
errorMessage: '',
prefilled: {},
},