@thisisagile/easy-test
Version:
Straightforward library for testing microservices built with @thisisagile/easy
1 lines • 964 B
Source Map (JSON)
{"version":3,"sources":["../../src/matchers/toBeValid.ts"],"sourcesContent":["import { Validatable } from '../utils/Types';\nimport { isA } from '../utils/Utils';\nimport { match } from './Match';\n\nexport const toBeValid = (v?: unknown): jest.CustomMatcherResult =>\n match<Validatable>(v as Validatable)\n .undefined(s => s, 'Subject is undefined.')\n .not(s => isA<Validatable>(s, 'isValid'), 'Subject is not validatable.')\n .not(s => s.isValid, `Subject is not valid.`)\n .else(`Subject is valid`);\n\nexpect.extend({\n toBeValid,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toBeValid(): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;AAIO,IAAM,YAAY,CAAC,MACxB,MAAmB,CAAgB,EAChC,UAAU,OAAK,GAAG,uBAAuB,EACzC,IAAI,OAAK,IAAiB,GAAG,SAAS,GAAG,6BAA6B,EACtE,IAAI,OAAK,EAAE,SAAS,uBAAuB,EAC3C,KAAK,kBAAkB;AAE5B,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}