mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Rename WebHook to Webhook
This commit is contained in:
@@ -12,11 +12,11 @@ import type { NotificationChannel } from '../../../../../src/server/notification
|
||||
import type { StateHandler } from '../../../../../src/server/notifications/StateHandler';
|
||||
import type {
|
||||
WebhookChannel2023,
|
||||
} from '../../../../../src/server/notifications/WebHookChannel2023/WebhookChannel2023Type';
|
||||
} from '../../../../../src/server/notifications/WebhookChannel2023/WebhookChannel2023Type';
|
||||
import {
|
||||
isWebHook2023Channel,
|
||||
isWebhook2023Channel,
|
||||
WebhookChannel2023Type,
|
||||
} from '../../../../../src/server/notifications/WebHookChannel2023/WebhookChannel2023Type';
|
||||
} from '../../../../../src/server/notifications/WebhookChannel2023/WebhookChannel2023Type';
|
||||
import { NOTIFY, RDF } from '../../../../../src/util/Vocabularies';
|
||||
import quad = DataFactory.quad;
|
||||
import blankNode = DataFactory.blankNode;
|
||||
@@ -63,10 +63,10 @@ describe('A WebhookChannel2023Type', (): void => {
|
||||
});
|
||||
|
||||
it('exposes a utility function to verify if a channel is a webhook channel.', async(): Promise<void> => {
|
||||
expect(isWebHook2023Channel(channel)).toBe(true);
|
||||
expect(isWebhook2023Channel(channel)).toBe(true);
|
||||
|
||||
(channel as NotificationChannel).type = 'something else';
|
||||
expect(isWebHook2023Channel(channel)).toBe(false);
|
||||
expect(isWebhook2023Channel(channel)).toBe(false);
|
||||
});
|
||||
|
||||
it('correctly parses notification channel bodies.', async(): Promise<void> => {
|
||||
@@ -11,8 +11,8 @@ import { getLoggerFor } from '../../../../../src/logging/LogUtil';
|
||||
import type { Notification } from '../../../../../src/server/notifications/Notification';
|
||||
import type {
|
||||
WebhookChannel2023,
|
||||
} from '../../../../../src/server/notifications/WebHookChannel2023/WebhookChannel2023Type';
|
||||
import { WebHookEmitter } from '../../../../../src/server/notifications/WebHookChannel2023/WebHookEmitter';
|
||||
} from '../../../../../src/server/notifications/WebhookChannel2023/WebhookChannel2023Type';
|
||||
import { WebhookEmitter } from '../../../../../src/server/notifications/WebhookChannel2023/WebhookEmitter';
|
||||
import { NotImplementedHttpError } from '../../../../../src/util/errors/NotImplementedHttpError';
|
||||
import { matchesAuthorizationScheme } from '../../../../../src/util/HeaderUtil';
|
||||
import { trimTrailingSlashes } from '../../../../../src/util/PathUtil';
|
||||
@@ -26,7 +26,7 @@ jest.mock('../../../../../src/logging/LogUtil', (): any => {
|
||||
return { getLoggerFor: (): Logger => logger };
|
||||
});
|
||||
|
||||
describe('A WebHookEmitter', (): void => {
|
||||
describe('A WebhookEmitter', (): void => {
|
||||
const fetchMock: jest.Mock = fetch as any;
|
||||
const baseUrl = 'http://example.com/';
|
||||
const serverWebId = 'http://example.com/.notifcations/webhooks/webid';
|
||||
@@ -52,7 +52,7 @@ describe('A WebHookEmitter', (): void => {
|
||||
let privateJwk: AlgJwk;
|
||||
let publicJwk: AlgJwk;
|
||||
let jwkGenerator: jest.Mocked<JwkGenerator>;
|
||||
let emitter: WebHookEmitter;
|
||||
let emitter: WebhookEmitter;
|
||||
|
||||
beforeEach(async(): Promise<void> => {
|
||||
fetchMock.mockResolvedValue({ status: 200 });
|
||||
@@ -70,7 +70,7 @@ describe('A WebHookEmitter', (): void => {
|
||||
getPublicKey: jest.fn().mockResolvedValue(publicJwk),
|
||||
};
|
||||
|
||||
emitter = new WebHookEmitter(baseUrl, webIdRoute, jwkGenerator);
|
||||
emitter = new WebhookEmitter(baseUrl, webIdRoute, jwkGenerator);
|
||||
});
|
||||
|
||||
it('errors if the channel type is wrong.', async(): Promise<void> => {
|
||||
@@ -139,7 +139,7 @@ describe('A WebHookEmitter', (): void => {
|
||||
|
||||
expect(logger.error).toHaveBeenCalledTimes(1);
|
||||
expect(logger.error).toHaveBeenLastCalledWith(
|
||||
`There was an issue emitting a WebHook notification with target ${channel.sendTo}: invalid request`,
|
||||
`There was an issue emitting a Webhook notification with target ${channel.sendTo}: invalid request`,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -3,17 +3,17 @@ import type { Operation } from '../../../../../src/http/Operation';
|
||||
import { BasicRepresentation } from '../../../../../src/http/representation/BasicRepresentation';
|
||||
import type { HttpRequest } from '../../../../../src/server/HttpRequest';
|
||||
import type { HttpResponse } from '../../../../../src/server/HttpResponse';
|
||||
import { WebHookWebId } from '../../../../../src/server/notifications/WebHookChannel2023/WebHookWebId';
|
||||
import { WebhookWebId } from '../../../../../src/server/notifications/WebhookChannel2023/WebhookWebId';
|
||||
import { readableToString } from '../../../../../src/util/StreamUtil';
|
||||
import { SOLID } from '../../../../../src/util/Vocabularies';
|
||||
const { namedNode, quad } = DataFactory;
|
||||
|
||||
describe('A WebHookWebId', (): void => {
|
||||
describe('A WebhookWebId', (): void => {
|
||||
const request: HttpRequest = {} as any;
|
||||
const response: HttpResponse = {} as any;
|
||||
let operation: Operation;
|
||||
const baseUrl = 'http://example.com/';
|
||||
let webIdHandler: WebHookWebId;
|
||||
let webIdHandler: WebhookWebId;
|
||||
|
||||
beforeEach(async(): Promise<void> => {
|
||||
operation = {
|
||||
@@ -23,7 +23,7 @@ describe('A WebHookWebId', (): void => {
|
||||
body: new BasicRepresentation(),
|
||||
};
|
||||
|
||||
webIdHandler = new WebHookWebId(baseUrl);
|
||||
webIdHandler = new WebhookWebId(baseUrl);
|
||||
});
|
||||
|
||||
it('returns a solid:oidcIssuer triple.', async(): Promise<void> => {
|
||||
@@ -41,7 +41,7 @@ describe('A WebHookWebId', (): void => {
|
||||
});
|
||||
|
||||
it('errors if the base URL is invalid.', async(): Promise<void> => {
|
||||
expect((): any => new WebHookWebId('very invalid URL'))
|
||||
expect((): any => new WebhookWebId('very invalid URL'))
|
||||
.toThrow('Invalid issuer URL: Unexpected "<very" on line 2.');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user