{"version":3,"file":"index.cjs","sources":["../../../src/vitest/index.ts"],"sourcesContent":["import { graphql, http } from \"msw\";\nimport { expect } from \"vitest\";\nimport { graphqlAssertions, httpAssertions } from \"../assertions/index.js\";\nimport type { AssertFn } from \"../types/index.js\";\nimport \"./vitest.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 }) => (interceptHttp ? interceptHttp(vi.fn, fn) : fn),\n    original,\n  );\n}\n\nconst originalQuery = graphql.query;\nconst originalMutation = graphql.mutation;\n\ngraphql.query = graphqlAssertions.reduce(\n  (fn, { interceptGql }) => (interceptGql ? interceptGql(vi.fn, fn) : fn),\n  originalQuery,\n);\n\ngraphql.mutation = graphqlAssertions.reduce(\n  (fn, { interceptGql }) => (interceptGql ? interceptGql(vi.fn, 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  ),\n);\n"],"names":["http","httpAssertions","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,KAAO,gBAAgB,aAAA,CAAc,EAAA,CAAG,EAAA,EAAI,EAAE,CAAA,GAAI,EAAA;AAAA,IACvE;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,KAAO,eAAe,YAAA,CAAa,EAAA,CAAG,EAAA,EAAI,EAAE,CAAA,GAAI,EAAA;AAAA,EACpE;AACF,CAAA;AAEAD,WAAA,CAAQ,WAAWC,uBAAA,CAAkB,MAAA;AAAA,EACnC,CAAC,EAAA,EAAI,EAAE,YAAA,EAAa,KAAO,eAAe,YAAA,CAAa,EAAA,CAAG,EAAA,EAAI,EAAE,CAAA,GAAI,EAAA;AAAA,EACpE;AACF,CAAA;AAEAC,aAAA,CAAO,MAAA;AAAA,EACL,CAAC,GAAGH,oBAAA,EAAgB,GAAGE,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;;"}