@thisisagile/easy-test
Version:
Straightforward library for testing microservices built with @thisisagile/easy
1 lines • 1.22 kB
Source Map (JSON)
{"version":3,"sources":["../../src/matchers/toBeQueriedWith.ts"],"sourcesContent":["import { match } from './Match';\nimport { Query } from '../utils/Types';\n\nexport const toBeQueriedWith = (query: jest.Mock, expected: Query): jest.CustomMatcherResult =>\n match<any[]>(query?.mock?.calls)\n .undefined(c => c, 'Query is unknown.')\n .not(c => c.length === 1, 'Query did not execute.')\n .not(\n c => c[0][0].toString() === expected?.toString(),\n c => `We expected query '${expected}', but we received query '${c[0][0]}' instead.`\n )\n .else(`Received query does match '${expected}'`);\n\nexpect.extend({\n toBeQueriedWith: toBeQueriedWith,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toBeQueriedWith(expected: Query): R;\n }\n }\n}\n"],"mappings":";;;;;;;AAGO,IAAM,kBAAkB,CAAC,OAAkB,aAChD,MAAa,OAAO,MAAM,KAAK,EAC5B,UAAU,OAAK,GAAG,mBAAmB,EACrC,IAAI,OAAK,EAAE,WAAW,GAAG,wBAAwB,EACjD;AAAA,EACC,OAAK,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,MAAM,UAAU,SAAS;AAAA,EAC/C,OAAK,sBAAsB,QAAQ,6BAA6B,EAAE,CAAC,EAAE,CAAC,CAAC;AACzE,EACC,KAAK,8BAA8B,QAAQ,GAAG;AAEnD,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}