{"version":3,"file":"index.cjs","sources":["../../../src/jest/index.ts"],"sourcesContent":["import { expect, jest } from \"@jest/globals\";\nimport { graphql, http } from \"msw\";\nimport { graphqlAssertions, httpAssertions } from \"../assertions/index.js\";\nimport type { AssertFn } from \"../types/index.js\";\nimport \"./jest.d.ts\";\n\nfor (const key in http) {\n  const original = http[key as keyof typeof http];\n  http[key as keyof typeof http] = httpAssertions.reduce(\n    (fn, { interceptHttp }) =>\n      interceptHttp ? interceptHttp(jest.fn as any, fn) : fn,\n    original,\n  );\n}\n\nconst originalQuery = graphql.query;\nconst originalMutation = graphql.mutation;\n\ngraphql.query = graphqlAssertions.reduce(\n  (fn, { interceptGql }) =>\n    interceptGql ? interceptGql(jest.fn as any, fn) : fn,\n  originalQuery,\n);\n\ngraphql.mutation = graphqlAssertions.reduce(\n  (fn, { interceptGql }) =>\n    interceptGql ? interceptGql(jest.fn as any, fn) : fn,\n  originalMutation,\n);\n\nexpect.extend(\n  [...httpAssertions, ...graphqlAssertions].reduce<Record<string, AssertFn>>(\n    (acc, { name, assert }) => {\n      acc[name] = assert;\n      return acc;\n    },\n    {},\n  ) as any,\n);\n"],"names":["http","httpAssertions","jest","graphql","graphqlAssertions","expect"],"mappings":";;;;;;AAMA,KAAA,MAAW,OAAOA,QAAA,EAAM;AACtB,EAAA,MAAM,QAAA,GAAWA,SAAK,GAAwB,CAAA;AAC9C,EAAAA,QAAA,CAAK,GAAwB,IAAIC,oBAAA,CAAe,MAAA;AAAA,IAC9C,CAAC,EAAA,EAAI,EAAE,aAAA,EAAc,KACnB,gBAAgB,aAAA,CAAcC,YAAA,CAAK,EAAA,EAAW,EAAE,CAAA,GAAI,EAAA;AAAA,IACtD;AAAA,GACF;AACF;AAEA,MAAM,gBAAgBC,WAAA,CAAQ,KAAA;AAC9B,MAAM,mBAAmBA,WAAA,CAAQ,QAAA;AAEjCA,WAAA,CAAQ,QAAQC,uBAAA,CAAkB,MAAA;AAAA,EAChC,CAAC,EAAA,EAAI,EAAE,YAAA,EAAa,KAClB,eAAe,YAAA,CAAaF,YAAA,CAAK,EAAA,EAAW,EAAE,CAAA,GAAI,EAAA;AAAA,EACpD;AACF,CAAA;AAEAC,WAAA,CAAQ,WAAWC,uBAAA,CAAkB,MAAA;AAAA,EACnC,CAAC,EAAA,EAAI,EAAE,YAAA,EAAa,KAClB,eAAe,YAAA,CAAaF,YAAA,CAAK,EAAA,EAAW,EAAE,CAAA,GAAI,EAAA;AAAA,EACpD;AACF,CAAA;AAEAG,cAAA,CAAO,MAAA;AAAA,EACL,CAAC,GAAGJ,oBAAA,EAAgB,GAAGG,uBAAiB,CAAA,CAAE,MAAA;AAAA,IACxC,CAAC,GAAA,EAAK,EAAE,IAAA,EAAM,QAAO,KAAM;AACzB,MAAA,GAAA,CAAI,IAAI,CAAA,GAAI,MAAA;AACZ,MAAA,OAAO,GAAA;AAAA,IACT,CAAA;AAAA,IACA;AAAC;AAEL,CAAA;;"}