mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00

Complete rewrite of the account management and related systems. Makes the architecture more modular, allowing for easier extensions and configurations.
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import type { Interaction } from '../../../../../src/identity/interaction/InteractionHandler';
|
|
import { CancelOidcHandler } from '../../../../../src/identity/interaction/oidc/CancelOidcHandler';
|
|
|
|
describe('A CancelOidcHandler', (): void => {
|
|
let oidcInteraction: Interaction;
|
|
let handler: CancelOidcHandler;
|
|
|
|
beforeEach(async(): Promise<void> => {
|
|
oidcInteraction = {
|
|
lastSubmission: { login: { accountId: 'id' }},
|
|
persist: jest.fn(),
|
|
session: {
|
|
cookie: 'cookie',
|
|
},
|
|
returnTo: 'returnTo',
|
|
} as any;
|
|
|
|
handler = new CancelOidcHandler();
|
|
});
|
|
|
|
it('finishes the interaction with an error.', async(): Promise<void> => {
|
|
await expect(handler.handle({ oidcInteraction } as any)).rejects.toThrow(expect.objectContaining({
|
|
statusCode: 302,
|
|
location: 'returnTo',
|
|
}));
|
|
expect(oidcInteraction.persist).toHaveBeenCalledTimes(1);
|
|
expect(oidcInteraction.result).toEqual({
|
|
error: 'access_denied',
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
error_description: 'User cancelled the interaction.',
|
|
});
|
|
});
|
|
});
|