From 79ef148350ca4aa6d7d03fcc4970c26f43e526fb Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Mon, 9 Aug 2021 12:03:54 -0400 Subject: [PATCH] Fixing consistent type assertions lint rule. --- src/WorkflowStep.spec.ts | 2 +- src/receivers/ExpressReceiver.spec.ts | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/WorkflowStep.spec.ts b/src/WorkflowStep.spec.ts index 7db5363a3..98928c565 100644 --- a/src/WorkflowStep.spec.ts +++ b/src/WorkflowStep.spec.ts @@ -96,7 +96,7 @@ describe('WorkflowStep', () => { const { validate } = await importWorkflowStep(); // intentionally casting to string to trigger failure - const badId = {} as string; + const badId: string = {}; const validationFn = () => validate(badId, MOCK_CONFIG_SINGLE); const expectedMsg = 'WorkflowStep expects a callback_id as the first argument'; diff --git a/src/receivers/ExpressReceiver.spec.ts b/src/receivers/ExpressReceiver.spec.ts index 4ab419009..02c617110 100644 --- a/src/receivers/ExpressReceiver.spec.ts +++ b/src/receivers/ExpressReceiver.spec.ts @@ -267,14 +267,14 @@ describe('ExpressReceiver', function () { it('should handle valid requests', async () => { // Arrange // tslint:disable-next-line: no-object-literal-type-assertion - const req = { body: { ssl_check: 1 } } as Request; + const req: Request = { body: { ssl_check: 1 } }; let sent = false; // tslint:disable-next-line: no-object-literal-type-assertion - const resp = { + const resp: Response = { send: () => { sent = true; }, - } as Response; + }; let errorResult: any; const next = (error: any) => { errorResult = error; @@ -291,14 +291,14 @@ describe('ExpressReceiver', function () { it('should work with other requests', async () => { // Arrange // tslint:disable-next-line: no-object-literal-type-assertion - const req = { body: { type: 'block_actions' } } as Request; + const req: Request = { body: { type: 'block_actions' } }; let sent = false; // tslint:disable-next-line: no-object-literal-type-assertion - const resp = { + const resp: Response = { send: () => { sent = true; }, - } as Response; + }; let errorResult: any; const next = (error: any) => { errorResult = error; @@ -317,14 +317,14 @@ describe('ExpressReceiver', function () { it('should handle valid requests', async () => { // Arrange // tslint:disable-next-line: no-object-literal-type-assertion - const req = { body: { type: 'url_verification', challenge: 'this is it' } } as Request; + const req: Request = { body: { type: 'url_verification', challenge: 'this is it' } }; let sentBody = undefined; // tslint:disable-next-line: no-object-literal-type-assertion - const resp = { + const resp: Response = { json: (body) => { sentBody = body; }, - } as Response; + }; let errorResult: any; const next = (error: any) => { errorResult = error; @@ -341,14 +341,14 @@ describe('ExpressReceiver', function () { it('should work with other requests', async () => { // Arrange // tslint:disable-next-line: no-object-literal-type-assertion - const req = { body: { ssl_check: 1 } } as Request; + const req: Request = { body: { ssl_check: 1 } }; let sentBody = undefined; // tslint:disable-next-line: no-object-literal-type-assertion - const resp = { + const resp: Response = { json: (body) => { sentBody = body; }, - } as Response; + }; let errorResult: any; const next = (error: any) => { errorResult = error;