chore: Update dependencies

This commit is contained in:
Joachim Van Herwegen
2023-10-11 15:10:19 +02:00
parent cf411e13fb
commit f932cf4b22
7 changed files with 3406 additions and 3457 deletions

View File

@@ -30,7 +30,7 @@ describe('An AllowAcceptHeaderWriter', (): void => {
let writer: AllowAcceptHeaderWriter;
beforeEach(async(): Promise<void> => {
response = createResponse();
response = createResponse() as HttpResponse;
writer = new AllowAcceptHeaderWriter(
[ 'OPTIONS', 'GET', 'HEAD', 'PUT', 'POST', 'PATCH', 'DELETE' ],
@@ -42,7 +42,7 @@ describe('An AllowAcceptHeaderWriter', (): void => {
await expect(writer.handleSafe({ response, metadata: document })).resolves.toBeUndefined();
const headers = response.getHeaders();
expect(typeof headers.allow).toBe('string');
expect(new Set((headers.allow as string).split(', ')))
expect(new Set(headers.allow!.split(', ')))
.toEqual(new Set([ 'OPTIONS', 'GET', 'HEAD', 'PUT', 'PATCH', 'DELETE' ]));
expect(headers['accept-patch']).toBe('text/n3, application/sparql-update');
expect(headers['accept-put']).toBe('*/*');
@@ -53,7 +53,7 @@ describe('An AllowAcceptHeaderWriter', (): void => {
await expect(writer.handleSafe({ response, metadata: emptyContainer })).resolves.toBeUndefined();
const headers = response.getHeaders();
expect(typeof headers.allow).toBe('string');
expect(new Set((headers.allow as string).split(', ')))
expect(new Set(headers.allow!.split(', ')))
.toEqual(new Set([ 'OPTIONS', 'GET', 'HEAD', 'POST', 'PATCH', 'DELETE' ]));
expect(headers['accept-patch']).toBe('text/n3, application/sparql-update');
expect(headers['accept-post']).toBe('*/*');
@@ -63,7 +63,7 @@ describe('An AllowAcceptHeaderWriter', (): void => {
await expect(writer.handleSafe({ response, metadata: fullContainer })).resolves.toBeUndefined();
const headers = response.getHeaders();
expect(typeof headers.allow).toBe('string');
expect(new Set((headers.allow as string).split(', ')))
expect(new Set(headers.allow!.split(', ')))
.toEqual(new Set([ 'OPTIONS', 'GET', 'HEAD', 'POST', 'PATCH' ]));
expect(headers['accept-patch']).toBe('text/n3, application/sparql-update');
expect(headers['accept-post']).toBe('*/*');
@@ -73,7 +73,7 @@ describe('An AllowAcceptHeaderWriter', (): void => {
await expect(writer.handleSafe({ response, metadata: storageContainer })).resolves.toBeUndefined();
const headers = response.getHeaders();
expect(typeof headers.allow).toBe('string');
expect(new Set((headers.allow as string).split(', ')))
expect(new Set(headers.allow!.split(', ')))
.toEqual(new Set([ 'OPTIONS', 'GET', 'HEAD', 'POST', 'PATCH' ]));
expect(headers['accept-patch']).toBe('text/n3, application/sparql-update');
expect(headers['accept-post']).toBe('*/*');
@@ -83,7 +83,7 @@ describe('An AllowAcceptHeaderWriter', (): void => {
await expect(writer.handleSafe({ response, metadata: error404 })).resolves.toBeUndefined();
const headers = response.getHeaders();
expect(typeof headers.allow).toBe('string');
expect(new Set((headers.allow as string).split(', ')))
expect(new Set(headers.allow!.split(', ')))
.toEqual(new Set([ 'PUT', 'PATCH' ]));
expect(headers['accept-patch']).toBe('text/n3, application/sparql-update');
expect(headers['accept-put']).toBe('*/*');
@@ -94,7 +94,7 @@ describe('An AllowAcceptHeaderWriter', (): void => {
await expect(writer.handleSafe({ response, metadata: error405 })).resolves.toBeUndefined();
const headers = response.getHeaders();
expect(typeof headers.allow).toBe('string');
expect(new Set((headers.allow as string).split(', ')))
expect(new Set(headers.allow!.split(', ')))
.toEqual(new Set([ 'OPTIONS', 'GET', 'HEAD', 'POST', 'PATCH', 'DELETE' ]));
expect(headers['accept-patch']).toBe('text/n3, application/sparql-update');
expect(headers['accept-put']).toBeUndefined();

View File

@@ -11,7 +11,7 @@ describe('RangeMetadataWriter', (): void => {
beforeEach(async(): Promise<void> => {
metadata = new RepresentationMetadata();
response = createResponse();
response = createResponse() as HttpResponse;
writer = new RangeMetadataWriter();
});

View File

@@ -4,6 +4,7 @@ import { RepresentationMetadata } from '../../../../../../src/http/representatio
import { OwnerMetadataWriter } from '../../../../../../src/identity/interaction/pod/util/OwnerMetadataWriter';
import { PodStore } from '../../../../../../src/identity/interaction/pod/util/PodStore';
import type { StorageLocationStrategy } from '../../../../../../src/server/description/StorageLocationStrategy';
import type { HttpResponse } from '../../../../../../src/server/HttpResponse';
import { joinUrl } from '../../../../../../src/util/PathUtil';
describe('An OwnerMetadataWriter', (): void => {
@@ -20,7 +21,7 @@ describe('An OwnerMetadataWriter', (): void => {
beforeEach(async(): Promise<void> => {
metadata = new RepresentationMetadata(target);
response = createResponse();
response = createResponse() as HttpResponse;
podStore = {
findByBaseUrl: jest.fn().mockResolvedValue({ id, accountId }),

View File

@@ -35,7 +35,7 @@ describe('A HandlerServerConfigurator', (): void => {
writeHead: jest.fn(),
} as any;
response.end.mockImplementation((): any => {
response.headersSent = true;
(response as any).headersSent = true;
});
response.writeHead.mockReturnValue(response);
@@ -43,7 +43,7 @@ describe('A HandlerServerConfigurator', (): void => {
handler = {
handleSafe: jest.fn((): void => {
response.headersSent = true;
(response as any).headersSent = true;
}),
} as any;
@@ -89,7 +89,7 @@ describe('A HandlerServerConfigurator', (): void => {
});
it('does not write an error if the response had been started.', async(): Promise<void> => {
response.headersSent = true;
(response as any).headersSent = true;
handler.handleSafe.mockRejectedValueOnce(new Error('dummyError'));
server.emit('request', request, response);
await flushPromises();