@thisisagile/easy-test
Version:
Straightforward library for testing microservices built with @thisisagile/easy
1 lines • 1.17 kB
Source Map (JSON)
{"version":3,"sources":["../../src/matchers/toMatchRoute.ts"],"sourcesContent":["import { Uri } from '../utils/Types';\nimport { match } from './Match';\nimport { asString } from '../utils/Utils';\n\nexport const toMatchRoute = (uri?: Uri, route?: Uri | string): jest.CustomMatcherResult =>\n match<Uri | undefined>(uri)\n .undefined(u => u, 'Subject is undefined.')\n .undefined(() => route, 'Route to include is undefined.')\n .not(\n u => asString(u).includes(asString(route)),\n u => `Uri '${u}' does not include '${route}'.`\n )\n .else(u => `Uri '${u}' includes '${route}'`);\n\nexpect.extend({\n toMatchRoute: toMatchRoute,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchRoute(route?: Uri | string): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;AAIO,IAAM,eAAe,CAAC,KAAW,UACtC,MAAuB,GAAG,EACvB,UAAU,OAAK,GAAG,uBAAuB,EACzC,UAAU,MAAM,OAAO,gCAAgC,EACvD;AAAA,EACC,OAAK,SAAS,CAAC,EAAE,SAAS,SAAS,KAAK,CAAC;AAAA,EACzC,OAAK,QAAQ,CAAC,uBAAuB,KAAK;AAC5C,EACC,KAAK,OAAK,QAAQ,CAAC,eAAe,KAAK,GAAG;AAE/C,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}