@thisisagile/easy-test
Version:
Straightforward library for testing microservices built with @thisisagile/easy
1 lines • 1.09 kB
Source Map (JSON)
{"version":3,"sources":["../../src/matchers/toMatchText.ts"],"sourcesContent":["import { match } from './Match';\nimport { asString } from '../utils/Utils';\n\nexport const toMatchText = (value?: unknown, text?: unknown): jest.CustomMatcherResult =>\n match<unknown>(value)\n .undefined(v => v, 'Subject is undefined.')\n .undefined(() => text, 'Text to match with is undefined.')\n .not(\n v => asString(v) === asString(text),\n v => `Text '${v}' does not match with text '${text}'.`\n )\n .else(v => `Text '${v}' matches`);\n\nexpect.extend({\n toMatchText: toMatchText,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchText(text?: unknown): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;AAGO,IAAM,cAAc,CAAC,OAAiB,SAC3C,MAAe,KAAK,EACjB,UAAU,OAAK,GAAG,uBAAuB,EACzC,UAAU,MAAM,MAAM,kCAAkC,EACxD;AAAA,EACC,OAAK,SAAS,CAAC,MAAM,SAAS,IAAI;AAAA,EAClC,OAAK,SAAS,CAAC,+BAA+B,IAAI;AACpD,EACC,KAAK,OAAK,SAAS,CAAC,WAAW;AAEpC,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}