Skip to content

Commit

Permalink
fix: typos
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Feb 5, 2021
1 parent c4ed3d8 commit 2db33e5
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/04_feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: "🧚‍♂️ Feature Request"
about: "Wouldnt it be nice if 💭"
about: "Wouldn't it be nice if 💭"
labels: feature
---

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ Asynchronous `error` event handler are not blocking the `.receive()` method from
<strong>Required.</strong>
Method to be run each time a webhook event handler throws an error or returns a promise that rejects.
The <code>handler</code> function can be an async function,
return a Promise. The handler is called with an error object that has a .event property which hass all the information on the event: <code>{id, name, payload}</code>.
return a Promise. The handler is called with an error object that has a .event property which has all the information on the event: <code>{id, name, payload}</code>.
</td>
</tr>
</table>
Expand Down
6 changes: 3 additions & 3 deletions src/event-handler/wrap-error-handler.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// Errors thrown or rejected Promises in "error" event handlers are not handled
// as they are in the webhook event handlers. If errors occur, we log a
// "Fatal: Error occured" message to stdout
// "Fatal: Error occurred" message to stdout
export function wrapErrorHandler(handler: Function, error: Error) {
let returnValue;

try {
returnValue = handler(error);
} catch (error) {
console.log('FATAL: Error occured in "error" event handler');
console.log('FATAL: Error occurred in "error" event handler');
console.log(error);
}

if (returnValue && returnValue.catch) {
returnValue.catch((error: Error) => {
console.log('FATAL: Error occured in "error" event handler');
console.log('FATAL: Error occurred in "error" event handler');
console.log(error);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function middleware(
// the next callback is set when used as an express middleware. That allows
// it to define custom routes like /my/custom/page while the webhooks are
// expected to be sent to the / root path. Otherwise the root path would
// match all requests and would make it impossible to define custom rooutes
// match all requests and would make it impossible to define custom routes
if (next) {
next();
return;
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export interface State extends Options<any> {
}

/**
* Error object with optional poperties coming from `octokit.request` errors
* Error object with optional properties coming from `octokit.request` errors
*/
export type WebhookError = Error & Partial<RequestError>;

Expand Down
6 changes: 3 additions & 3 deletions test/integration/sign-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test("sign({secret, algorithm}) with invalid algorithm throws", () => {
});

describe("with eventPayload as object", () => {
describe("resturns expected sha1 signature", () => {
describe("returns expected sha1 signature", () => {
test("sign(secret, eventPayload)", () => {
const signature = sign(secret, eventPayload);
expect(signature).toBe("sha1=d03207e4b030cf234e3447bac4d93add4c6643d8");
Expand All @@ -44,7 +44,7 @@ describe("with eventPayload as object", () => {
});
});

describe("resturns expected sha256 signature", () => {
describe("returns expected sha256 signature", () => {
test("sign({secret, algorithm}, eventPayload)", () => {
const signature = sign({ secret, algorithm: "sha256" }, eventPayload);
expect(signature).toBe(
Expand All @@ -55,7 +55,7 @@ describe("with eventPayload as object", () => {
});

describe("with eventPayload as string", () => {
describe("resturns expected sha1 signature", () => {
describe("returns expected sha1 signature", () => {
test("sign(secret, eventPayload)", () => {
const signature = sign(secret, JSON.stringify(eventPayload));
expect(signature).toBe("sha1=d03207e4b030cf234e3447bac4d93add4c6643d8");
Expand Down
10 changes: 5 additions & 5 deletions test/typescript-validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,25 @@ export default async function () {

// Check that all options are optional except for secret
new Webhooks({
secret: "bleh",
secret: "blah",
});

// Check all supported options
const webhooks = new Webhooks({
secret: "bleh",
secret: "blah",
path: "/webhooks",
transform: (event) => {
console.log(event.payload);
return Object.assign(event, { foo: "bar" });
},
});

// Check named expors of new API work
// Check named exports of new API work
createWebhooksApi({
secret: "bleh",
secret: "blah",
});

createEventHandler({ secret: "bleh" });
createEventHandler({ secret: "blah" });

createMiddleware({
secret: "mysecret",
Expand Down
4 changes: 2 additions & 2 deletions test/unit/middleware-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("when does a timeout on retrieving the payload", () => {
jest.useFakeTimers();
});

test("successfully, does NOT respone.end(ok)", async () => {
test("successfully, does NOT response.end(ok)", async () => {
const responseMock = ({ end: jest.fn() } as unknown) as ServerResponse;
const next = jest.fn();

Expand Down Expand Up @@ -61,7 +61,7 @@ describe("when does a timeout on retrieving the payload", () => {
expect(responseMock.end).not.toHaveBeenCalledWith("ok\n");
});

test("failing, does NOT respone.end(ok)", async () => {
test("failing, does NOT response.end(ok)", async () => {
const responseMock = ({ end: jest.fn() } as unknown) as ServerResponse;
const next = jest.fn();

Expand Down

0 comments on commit 2db33e5

Please sign in to comment.