From 9ec79c0471d2d248a36ab91d98b784cfc0e8d647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Pereira?= Date: Mon, 19 Jun 2023 18:53:43 -0300 Subject: [PATCH] fix: fix types --- src/chains/__tests__/Chain.spec.ts | 6 ++---- src/patterns/__tests__/Patterns.test.ts | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/chains/__tests__/Chain.spec.ts b/src/chains/__tests__/Chain.spec.ts index 2dd828a..bd773b3 100644 --- a/src/chains/__tests__/Chain.spec.ts +++ b/src/chains/__tests__/Chain.spec.ts @@ -6,10 +6,9 @@ jest.mock('../core/ChainLink'); describe('Chain', () => { it('Should call exec method', async () => { const chain = new Chain([]); - const ctx = jest.fn(); const chainSpy = jest.spyOn(chain, 'exec'); - await chain.exec('any-string', ctx); + await chain.exec('any-string'); expect(chainSpy).toBeCalledTimes(1); }); @@ -29,12 +28,11 @@ describe('Chain', () => { it('Should call ChainLink handle when exec runs', async () => { const chainLinkOne = new ChainLink(jest.fn()); const chainLinkTwo = new ChainLink(jest.fn()); - const ctx = jest.fn(); const chain = new Chain([chainLinkOne, chainLinkTwo]); const chainSpy = jest.spyOn(chain, 'exec'); - await chain.exec('any-string', ctx); + await chain.exec('any-string'); expect(chainLinkOne.handle).toBeCalledTimes(1); expect(chainSpy).toBeCalledTimes(1); diff --git a/src/patterns/__tests__/Patterns.test.ts b/src/patterns/__tests__/Patterns.test.ts index 3481816..40d1889 100644 --- a/src/patterns/__tests__/Patterns.test.ts +++ b/src/patterns/__tests__/Patterns.test.ts @@ -4,7 +4,7 @@ describe('Patterns', () => { describe('Common', () => { describe('Email', () => { const cases = Patterns.Common.Email.map( - (_, index): [string, string, boolean][] => { + (_, index): [string, RegExp, boolean][] => { return [ ['match', Patterns.Common.Email[index], true], ['not match', Patterns.Common.Email[index], false], @@ -13,7 +13,7 @@ describe('Patterns', () => { ).flat(); it.each(cases)( 'Should %s string with pattern %s', - (_: string, __: string, value: boolean) => { + (_: string, __: RegExp, value: boolean) => { const email = value ? 'name.lastname@provider.com' : 'email.provedor.com'; @@ -47,7 +47,7 @@ describe('Patterns', () => { ]; const cases = Patterns.Brazil.BankSlip.map( - (_, index): [string, string, boolean, number][] => { + (_, index): [string, RegExp, boolean, number][] => { return [ ['match', Patterns.Brazil.BankSlip[index], true, index], ['not match', Patterns.Brazil.BankSlip[index], false, index], @@ -57,7 +57,7 @@ describe('Patterns', () => { it.each(cases)( 'Should %s string with pattern %s', - (_: string, __: string, value: boolean, index: number) => { + (_: string, __: RegExp, value: boolean, index: number) => { const data = value ? formats[index] : wrongFormats[index]; const patterns = Patterns.Brazil.BankSlip.map( (pattern) => new RegExp(pattern)