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

The previous package was outdated, preventing us from updating TS. This one also lints YAML and JSON, and applies many more rules to the test files, explaining all the changes in this PR.
33 lines
1.0 KiB
TypeScript
33 lines
1.0 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',
|
|
error_description: 'User cancelled the interaction.',
|
|
});
|
|
});
|
|
});
|