mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
16 lines
742 B
TypeScript
16 lines
742 B
TypeScript
import type { Operation } from '../../../../src/http/Operation';
|
|
import { FixedInteractionHandler } from '../../../../src/identity/interaction/FixedInteractionHandler';
|
|
import { readJsonStream } from '../../../../src/util/StreamUtil';
|
|
|
|
describe('A FixedInteractionHandler', (): void => {
|
|
const json = { data: 'data' };
|
|
const operation: Operation = { target: { path: 'http://example.com/test/' }} as any;
|
|
const handler = new FixedInteractionHandler(json);
|
|
|
|
it('returns the given JSON as response.', async(): Promise<void> => {
|
|
const response = await handler.handle({ operation });
|
|
await expect(readJsonStream(response.data)).resolves.toEqual(json);
|
|
expect(response.metadata.contentType).toBe('application/json');
|
|
});
|
|
});
|