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

* feat: initial StremingHTTPChannel2023 notifications Co-authored-by: Maciej Samoraj <maciej.samoraj@gmail.com> * test: unit for StremingHTTPChannel2023 notifications Co-authored-by: Maciej Samoraj <maciej.samoraj@gmail.com> * test: integration for StremingHTTPChannel2023 notifications Co-authored-by: Maciej Samoraj <maciej.samoraj@gmail.com> * emit initial notification on streaming http channel * fix linting erros * ensure canceling fetch body in integration tests * extract defaultChannel for topic into util * add documentation * Apply suggestions from code review Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com> * only generate notifications when needed Co-authored-by: Maciej Samoraj <maciej.samoraj@gmail.com> * test: set body timeout to pass on node >21 Co-authored-by: Maciej Samoraj <maciej.samoraj@gmail.com> * address review feedback * remove node 21 workaround * add architecture documentation * Apply suggestions from code review Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com> --------- Co-authored-by: Maciej Samoraj <maciej.samoraj@gmail.com> Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com> Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>
21 lines
1.1 KiB
TypeScript
21 lines
1.1 KiB
TypeScript
import { createResponse } from 'node-mocks-http';
|
|
import {
|
|
StreamingHttpMetadataWriter,
|
|
} from '../../../../../src/server/notifications/StreamingHttpChannel2023/StreamingHttpMetadataWriter';
|
|
import { RepresentationMetadata } from '../../../../../src/http/representation/RepresentationMetadata';
|
|
import type { HttpResponse } from '../../../../../src/server/HttpResponse';
|
|
|
|
describe('A StreamingHttpMetadataWriter', (): void => {
|
|
const baseUrl = 'http://example.org/';
|
|
const pathPrefix = '.notifications/StreamingHTTPChannel2023/';
|
|
const writer = new StreamingHttpMetadataWriter(baseUrl, pathPrefix);
|
|
const rel = 'http://www.w3.org/ns/solid/terms#updatesViaStreamingHttp2023';
|
|
|
|
it('adds the correct link header.', async(): Promise<void> => {
|
|
const response = createResponse() as HttpResponse;
|
|
const metadata = new RepresentationMetadata({ path: 'http://example.org/foo/bar/baz' });
|
|
await expect(writer.handle({ response, metadata })).resolves.toBeUndefined();
|
|
expect(response.getHeaders()).toEqual({ link: `<http://example.org/.notifications/StreamingHTTPChannel2023/foo/bar/baz>; rel="${rel}"` });
|
|
});
|
|
});
|