UNPKG

msw-request-assertions

Version:
1 lines 77.7 kB
{"version":3,"file":"index-OMx971oM.cjs","sources":["../../src/utils/checkMockedHandler.ts","../../src/assertions/toHaveBeenRequested/toHaveBeenRequested.ts","../../src/assertions/toHaveBeenRequested/toHaveBeenRequestedTimes.ts","../../src/utils/checkEquality.ts","../../src/utils/formatMockCalls.ts","../../src/assertions/toHaveBeenRequestedWith/getCalls.ts","../../src/assertions/toHaveBeenRequestedWith/toHaveBeenNthRequestedWith.ts","../../src/assertions/toHaveBeenRequestedWith/toHaveBeenRequestedWith.ts","../../src/assertions/toHaveBeenRequestedWithBody/toHaveBeenNthRequestedWithBody.ts","../../src/assertions/toHaveBeenRequestedWithBody/toHaveBeenRequestedWithBody.ts","../../src/utils/checkMockedGraphQLHandler.ts","../../src/assertions/toHaveBeenRequestedWithGqlQuery/toHaveBeenNthRequestedWithGqlQuery.ts","../../src/assertions/toHaveBeenRequestedWithGqlQuery/toHaveBeenRequestedWithGqlQuery.ts","../../src/assertions/toHaveBeenRequestedWithGqlVariables/toHaveBeenNthRequestedWithGqlVariables.ts","../../src/assertions/toHaveBeenRequestedWithGqlVariables/toHaveBeenRequestedWithGqlVariables.ts","../../src/assertions/toHaveBeenRequestedWithHash/toHaveBeenNthRequestedWithHash.ts","../../src/assertions/toHaveBeenRequestedWithHash/toHaveBeenRequestedWithHash.ts","../../src/assertions/toHaveBeenRequestedWithHeaders/toHaveBeenNthRequestedWithHeaders.ts","../../src/assertions/toHaveBeenRequestedWithHeaders/toHaveBeenRequestedWithHeaders.ts","../../src/assertions/toHaveBeenRequestedWithJsonBody/toHaveBeenNthRequestedWithJsonBody.ts","../../src/assertions/toHaveBeenRequestedWithJsonBody/toHaveBeenRequestedWithJsonBody.ts","../../src/assertions/toHaveBeenRequestedWithPathParameters/toHaveBeenNthRequestedWithPathParameters.ts","../../src/assertions/toHaveBeenRequestedWithPathParameters/toHaveBeenRequestedWithPathParameters.ts","../../src/assertions/toHaveBeenRequestedWithQueryString/toHaveBeenNthRequestedWithQueryString.ts","../../src/assertions/toHaveBeenRequestedWithQueryString/toHaveBeenRequestedWithQueryString.ts","../../src/assertions/index.ts"],"sourcesContent":["import { GraphQLHandler, HttpHandler } from \"msw\";\n\nexport function checkMockedHandler(\n input: unknown,\n): asserts input is HttpHandler | GraphQLHandler {\n const isHttpHandler = input instanceof HttpHandler;\n const isGraphQLHandler = input instanceof GraphQLHandler;\n\n if (!isHttpHandler && !isGraphQLHandler) {\n throw new Error(\"Expected a HttpHandler or GraphQLHandler\");\n }\n}\n","import type { Mock } from \"vitest\";\nimport type { Assertion } from \"../../types/index.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\n\ndeclare module \"msw\" {\n interface HttpHandler {\n requestedAssertion?: Mock;\n }\n\n interface GraphQLHandler {\n requestedAssertion?: Mock;\n }\n}\n\nexport const toHaveBeenRequested: Assertion = {\n name: \"toHaveBeenRequested\",\n interceptHttp:\n (mockFn, original) =>\n (path, resolver, options, ...rest) => {\n const requestedAssertion = mockFn();\n requestedAssertion.mockName(\n typeof path === \"string\" ? path : path.source,\n );\n\n const newResolver: typeof resolver = (info, ...args) => {\n requestedAssertion();\n\n return resolver(info, ...args);\n };\n\n const handler = original(path, newResolver, options, ...rest);\n\n handler.requestedAssertion = requestedAssertion;\n\n return handler;\n },\n interceptGql:\n (mockFn, original) =>\n (path, resolver, options, ...rest) => {\n const requestedAssertion = mockFn();\n requestedAssertion.mockName(\n typeof path === \"string\"\n ? path\n : \"source\" in path\n ? path.source\n : JSON.stringify(path),\n );\n\n const newResolver: typeof resolver = (info, ...args) => {\n requestedAssertion();\n\n return resolver(info, ...args);\n };\n\n const handler = original(path, newResolver, options, ...rest);\n\n handler.requestedAssertion = requestedAssertion;\n\n return handler;\n },\n assert: function (received) {\n checkMockedHandler(received);\n if (!received.requestedAssertion)\n throw new Error(\"No request assertion found\");\n\n const calls = received.requestedAssertion.mock.calls;\n\n const { isNot } = this;\n return {\n pass: calls.length > 0,\n message: () =>\n `Expected ${received.requestedAssertion?.getMockName()} to${isNot ? \" not\" : \"\"} have been requested`,\n };\n },\n};\n","import type { Assertion } from \"../../types/index.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\n\nexport const toHaveBeenRequestedTimes: Assertion = {\n name: \"toHaveBeenRequestedTimes\",\n interceptHttp: (_mockFn, original) => original,\n interceptGql: (_mockFn, original) => original,\n assert: function (received, expectedTimes) {\n checkMockedHandler(received);\n if (!received.requestedAssertion)\n throw new Error(\"No request assertion found\");\n\n const calls = received.requestedAssertion.mock.calls;\n const actualTimes = calls.length;\n\n const { isNot } = this;\n return {\n pass: actualTimes === expectedTimes,\n message: () =>\n `Expected ${received.requestedAssertion?.getMockName()} to${isNot ? \" not\" : \"\"} have been requested ${expectedTimes} times, but it was requested ${actualTimes} times`,\n };\n },\n};\n","const isPlainObject = (value: unknown): value is Record<string, unknown> => {\n return (\n typeof value === \"object\" && value !== null && value.constructor === Object\n );\n};\n\nexport const checkEquality = (expected: unknown, actual: unknown): boolean => {\n if (expected === actual) {\n return true;\n }\n\n if (\n typeof expected === \"object\" &&\n expected !== null &&\n \"asymmetricMatch\" in expected &&\n typeof expected.asymmetricMatch === \"function\"\n ) {\n return expected.asymmetricMatch(actual);\n }\n\n if (\n typeof actual === \"object\" &&\n actual !== null &&\n \"asymmetricMatch\" in actual &&\n typeof actual.asymmetricMatch === \"function\"\n ) {\n return actual.asymmetricMatch(expected);\n }\n\n if (expected === null || actual === null) {\n return expected === actual;\n }\n\n if (expected === undefined || actual === undefined) {\n return expected === actual;\n }\n\n if (typeof expected !== typeof actual) {\n return false;\n }\n\n if (Array.isArray(expected) && Array.isArray(actual)) {\n if (expected.length !== actual.length) {\n return false;\n }\n\n return expected.every((item, index) => checkEquality(item, actual[index]));\n }\n\n if (isPlainObject(expected) && isPlainObject(actual)) {\n const expectedKeys = Object.keys(expected);\n const actualKeys = Object.keys(actual);\n\n if (expectedKeys.length !== actualKeys.length) {\n return false;\n }\n\n return expectedKeys.every(\n (key) =>\n actualKeys.includes(key) && checkEquality(expected[key], actual[key]),\n );\n }\n\n return false;\n};\n","export const ordinalOf = (i: number) => {\n const j = i % 10;\n const k = i % 100;\n\n if (j === 1 && k !== 11) {\n return `${i}st`;\n }\n\n if (j === 2 && k !== 12) {\n return `${i}nd`;\n }\n\n if (j === 3 && k !== 13) {\n return `${i}rd`;\n }\n\n return `${i}th`;\n};\n\nexport const formatMockCalls = (name: string, calls: unknown[][], msg = \"\") => {\n if (calls.length) {\n msg += `\\n\\nReceived: \\n\\n${calls\n .map((callArg, i) => {\n let methodCall = ` ${ordinalOf(i + 1)} ${name} call:\\n\\n`;\n\n methodCall += JSON.stringify(callArg[0])\n .split(\"\\n\")\n .map((line) => ` ${line}`)\n .join(\"\\n\");\n\n methodCall += \"\\n\";\n return methodCall;\n })\n .join(\"\\n\")}`;\n }\n msg += `\\n\\nNumber of calls: ${calls.length}\\n`;\n return msg;\n};\n","import { GraphQLHandler, type HttpHandler } from \"msw\";\n\nexport const getCalls = (\n received: HttpHandler | GraphQLHandler,\n expected: unknown,\n) => {\n if (!expected) throw new Error(\"Expected must be defined\");\n if (typeof expected !== \"object\")\n throw new Error(\"Expected must be an object\");\n\n const bodyAssertionCalls = received.bodyAssertion?.mock.calls ?? [];\n const queryStringAssertionCalls =\n received.queryStringAssertion?.mock.calls ?? [];\n const jsonBodyAssertionCalls = received.jsonBodyAssertion?.mock.calls ?? [];\n const headersAssertionCalls = received.headersAssertion?.mock.calls ?? [];\n const hashAssertionCalls = received.hashAssertion?.mock.calls ?? [];\n const pathParametersAssertionCalls =\n received.pathParametersAssertion?.mock.calls || [];\n const gqlVariablesAssertionCalls =\n received instanceof GraphQLHandler\n ? (received.gqlVariablesAssertion?.mock.calls ?? [])\n : [];\n const gqlQueryAssertionCalls =\n received instanceof GraphQLHandler\n ? (received.gqlQueryAssertion?.mock.calls ?? [])\n : [];\n\n return bodyAssertionCalls.map((bodyAssertionCall, idx) => {\n const call: { [key: string]: unknown } = {};\n\n if (\"jsonBody\" in expected) {\n call.jsonBody = jsonBodyAssertionCalls[idx]?.[0];\n }\n if (\"body\" in expected) {\n call.body = bodyAssertionCall?.[0];\n }\n if (\"queryString\" in expected) {\n call.queryString = queryStringAssertionCalls[idx]?.[0];\n }\n if (\"headers\" in expected) {\n call.headers = headersAssertionCalls[idx]?.[0];\n }\n if (\"hash\" in expected) {\n call.hash = hashAssertionCalls[idx]?.[0];\n }\n if (\"pathParameters\" in expected) {\n call.pathParameters = pathParametersAssertionCalls[idx]?.[0];\n }\n if (\"gqlVariables\" in expected) {\n call.gqlVariables = gqlVariablesAssertionCalls[idx]?.[0];\n }\n if (\"gqlQuery\" in expected) {\n call.gqlQuery = gqlQueryAssertionCalls[idx]?.[0];\n }\n\n return call;\n });\n};\n","import type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls, ordinalOf } from \"../../utils/formatMockCalls.js\";\nimport { getCalls } from \"./getCalls.js\";\n\nexport const toHaveBeenNthRequestedWith: Assertion = {\n name: \"toHaveBeenNthRequestedWith\",\n interceptHttp: (_mockFn, original) => original,\n interceptGql: (_mockFn, original) => original,\n assert: function (received, time, expected) {\n checkMockedHandler(received);\n if (!received.requestedAssertion) throw new Error(\"No assertion found\");\n\n const calls = getCalls(received, expected);\n const nthCall = calls[time - 1];\n\n const { isNot } = this;\n const name = received.requestedAssertion.getMockName();\n\n return {\n pass: checkEquality(expected, nthCall),\n message: () =>\n formatMockCalls(\n name,\n calls.map((call) => [call]),\n `Expected ${name} to${isNot ? \" not\" : \"\"} have been requested the ${ordinalOf(time)} time with request matching ${this.utils.printExpected(JSON.stringify(expected))}, but it was requested with ${this.utils.printReceived(JSON.stringify(nthCall))}`,\n ),\n };\n },\n};\n","import type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls } from \"../../utils/formatMockCalls.js\";\nimport { getCalls } from \"./getCalls.js\";\n\nexport const toHaveBeenRequestedWith: Assertion = {\n name: \"toHaveBeenRequestedWith\",\n interceptHttp: (_mockFn, original) => original,\n interceptGql: (_mockFn, original) => original,\n assert: function (received, expected) {\n checkMockedHandler(received);\n if (!received.requestedAssertion) throw new Error(\"No assertion found\");\n\n const calls = getCalls(received, expected);\n\n const { isNot } = this;\n const name = received.requestedAssertion.getMockName();\n\n return {\n pass: calls.some((call) => checkEquality(expected, call)),\n message: () =>\n formatMockCalls(\n name,\n calls.map((call) => [call]),\n `Expected ${name} to${isNot ? \" not\" : \"\"} have been requested with body ${this.utils.printExpected(JSON.stringify(expected))}`,\n ),\n };\n },\n};\n","import type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls, ordinalOf } from \"../../utils/formatMockCalls.js\";\n\nexport const toHaveBeenNthRequestedWithBody: Assertion = {\n name: \"toHaveBeenNthRequestedWithBody\",\n interceptHttp: (_mockFn, original) => original,\n interceptGql: (_mockFn, original) => original,\n assert: function (received, time, expected) {\n checkMockedHandler(received);\n const assertion = received.bodyAssertion;\n if (!assertion) throw new Error(\"No body assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n const actualBody = calls[time - 1]?.[0];\n\n const { isNot } = this;\n return {\n pass: checkEquality(actualBody, expected),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${name} to${isNot ? \" not\" : \"\"} have been requested the ${ordinalOf(time)} time with body ${this.utils.printExpected(expected)}, but it was requested with ${this.utils.printReceived(actualBody)}`,\n ),\n };\n },\n};\n","import type { Mock } from \"vitest\";\nimport type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls } from \"../../utils/formatMockCalls.js\";\n\ndeclare module \"msw\" {\n interface HttpHandler {\n bodyAssertion?: Mock;\n }\n interface GraphQLHandler {\n bodyAssertion?: Mock;\n }\n}\n\nexport const toHaveBeenRequestedWithBody: Assertion = {\n name: \"toHaveBeenRequestedWithBody\",\n interceptHttp:\n (mockFn, original) =>\n (path, resolver, options, ...rest) => {\n const bodyAssertion = mockFn();\n bodyAssertion.mockName(typeof path === \"string\" ? path : path.source);\n\n const newResolver: typeof resolver = async (info, ...args) => {\n const { request } = info;\n const clone = request.clone();\n const payload = await clone.text();\n\n bodyAssertion(payload);\n\n return resolver(info, ...args);\n };\n\n const handler = original(path, newResolver, options, ...rest);\n\n handler.bodyAssertion = bodyAssertion;\n\n return handler;\n },\n interceptGql:\n (mockFn, original) =>\n (operationName, resolver, options, ...rest) => {\n const bodyAssertion = mockFn();\n bodyAssertion.mockName(\n typeof operationName === \"string\"\n ? operationName\n : operationName.toString(),\n );\n\n const newResolver: typeof resolver = async (info, ...args) => {\n const { request } = info;\n const clone = request.clone();\n const payload = await clone.text();\n\n bodyAssertion(payload);\n\n return resolver(info, ...args);\n };\n\n const handler = original(operationName, newResolver, options, ...rest);\n\n handler.bodyAssertion = bodyAssertion;\n\n return handler;\n },\n assert: function (received, expected) {\n checkMockedHandler(received);\n const assertion = received.bodyAssertion;\n if (!assertion) throw new Error(\"No body assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n\n const { isNot } = this;\n return {\n pass: calls.some((call) => checkEquality(call[0], expected)),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${assertion?.getMockName()} to${isNot ? \" not\" : \"\"} have been requested with body ${this.utils.printExpected(expected)}`,\n ),\n };\n },\n};\n","import { GraphQLHandler } from \"msw\";\n\nexport function checkMockedGraphQLHandler(\n input: unknown,\n): asserts input is GraphQLHandler {\n if (!(input instanceof GraphQLHandler)) {\n throw new Error(\"Expected a GraphQLHandler\");\n }\n}\n","import type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedGraphQLHandler } from \"../../utils/checkMockedGraphQLHandler.js\";\nimport { formatMockCalls, ordinalOf } from \"../../utils/formatMockCalls.js\";\n\nexport const toHaveBeenNthRequestedWithGqlQuery: Assertion = {\n name: \"toHaveBeenNthRequestedWithGqlQuery\",\n interceptGql: (_mockFn, original) => original,\n assert: function (received, time, expected) {\n checkMockedGraphQLHandler(received);\n const assertion = received.gqlQueryAssertion;\n if (!assertion) throw new Error(\"No GraphQL query assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n const nthCall = calls[time - 1]?.[0];\n\n const { isNot } = this;\n return {\n pass: checkEquality(nthCall, expected),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${assertion?.getMockName()} to${isNot ? \" not\" : \"\"} have been requested the ${ordinalOf(time)} time with GraphQL query ${this.utils.printExpected(expected)}, but it was requested with ${this.utils.printReceived(nthCall)}`,\n ),\n };\n },\n};\n","import type { Mock } from \"vitest\";\nimport type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedGraphQLHandler } from \"../../utils/checkMockedGraphQLHandler.js\";\nimport { formatMockCalls } from \"../../utils/formatMockCalls.js\";\n\ndeclare module \"msw\" {\n interface GraphQLHandler {\n gqlQueryAssertion?: Mock;\n }\n}\n\nexport const toHaveBeenRequestedWithGqlQuery: Assertion = {\n name: \"toHaveBeenRequestedWithGqlQuery\",\n interceptGql:\n (mockFn, original) =>\n (operationName, resolver, options, ...rest) => {\n const gqlQueryAssertion = mockFn();\n gqlQueryAssertion.mockName(\n typeof operationName === \"string\"\n ? operationName\n : operationName.toString(),\n );\n\n const newResolver: typeof resolver = (info, ...args) => {\n const { query } = info;\n gqlQueryAssertion(query);\n\n return resolver(info, ...args);\n };\n\n const handler = original(operationName, newResolver, options, ...rest);\n\n handler.gqlQueryAssertion = gqlQueryAssertion;\n\n return handler;\n },\n assert: function (received, expected) {\n checkMockedGraphQLHandler(received);\n const assertion = received.gqlQueryAssertion;\n if (!assertion) throw new Error(\"No GraphQL query assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n\n const { isNot } = this;\n return {\n pass: calls.some((call) => checkEquality(call[0], expected)),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${assertion?.getMockName()} to${isNot ? \" not\" : \"\"} have been requested with GraphQL query ${this.utils.printExpected(expected)}`,\n ),\n };\n },\n};\n","import type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedGraphQLHandler } from \"../../utils/checkMockedGraphQLHandler.js\";\nimport { formatMockCalls, ordinalOf } from \"../../utils/formatMockCalls.js\";\n\nexport const toHaveBeenNthRequestedWithGqlVariables: Assertion = {\n name: \"toHaveBeenNthRequestedWithGqlVariables\",\n interceptGql: (_mockFn, original) => original,\n assert: function (received, time, expected) {\n checkMockedGraphQLHandler(received);\n const assertion = received.gqlVariablesAssertion;\n if (!assertion) throw new Error(\"No GraphQL variables assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n const nthCall = calls[time - 1];\n\n const isMatch = checkEquality(nthCall?.[0], expected);\n\n const { isNot } = this;\n return {\n pass: isMatch,\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${name} to${isNot ? \" not\" : \"\"} have been requested the ${ordinalOf(time)} time with GraphQL variables ${this.utils.printExpected(JSON.stringify(expected))}, but it was requested with ${this.utils.printReceived(JSON.stringify(nthCall?.[0]))}`,\n ),\n };\n },\n};\n","import type { Mock } from \"vitest\";\nimport type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedGraphQLHandler } from \"../../utils/checkMockedGraphQLHandler.js\";\nimport { formatMockCalls } from \"../../utils/formatMockCalls.js\";\n\ndeclare module \"msw\" {\n interface GraphQLHandler {\n gqlVariablesAssertion?: Mock;\n }\n}\n\nexport const toHaveBeenRequestedWithGqlVariables: Assertion = {\n name: \"toHaveBeenRequestedWithGqlVariables\",\n interceptGql:\n (mockFn, original) =>\n (operationName, resolver, options, ...rest) => {\n const gqlVariablesAssertion = mockFn();\n gqlVariablesAssertion.mockName(\n typeof operationName === \"string\"\n ? operationName\n : operationName.toString(),\n );\n\n const newResolver: typeof resolver = (info, ...args) => {\n const { variables } = info;\n gqlVariablesAssertion(variables);\n\n return resolver(info, ...args);\n };\n\n const handler = original(operationName, newResolver, options, ...rest);\n\n handler.gqlVariablesAssertion = gqlVariablesAssertion;\n\n return handler;\n },\n assert: function (received, expected) {\n checkMockedGraphQLHandler(received);\n const assertion = received.gqlVariablesAssertion;\n if (!assertion) throw new Error(\"No GraphQL variables assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n\n const { isNot } = this;\n return {\n pass: calls.some((call) => checkEquality(call[0], expected)),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${received.gqlVariablesAssertion?.getMockName()} to${isNot ? \" not\" : \"\"} have been requested with GraphQL variables ${this.utils.printExpected(JSON.stringify(expected))}`,\n ),\n };\n },\n};\n","import type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls, ordinalOf } from \"../../utils/formatMockCalls.js\";\n\nexport const toHaveBeenNthRequestedWithHash: Assertion = {\n name: \"toHaveBeenNthRequestedWithHash\",\n interceptHttp: (_mockFn, original) => original,\n interceptGql: (_mockFn, original) => original,\n assert: function (received, time, expected) {\n checkMockedHandler(received);\n const assertion = received.hashAssertion;\n if (!assertion) throw new Error(\"No hash assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n const nthCall = calls[time - 1]?.[0];\n\n const { isNot } = this;\n return {\n pass: checkEquality(nthCall, expected),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${name} to${isNot ? \" not\" : \"\"} have been requested the ${ordinalOf(time)} time with hash ${this.utils.printExpected(expected)}, but it was requested with ${this.utils.printReceived(nthCall)}`,\n ),\n };\n },\n};\n","import type { Mock } from \"vitest\";\nimport type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls } from \"../../utils/formatMockCalls.js\";\n\ndeclare module \"msw\" {\n interface HttpHandler {\n hashAssertion?: Mock;\n }\n interface GraphQLHandler {\n hashAssertion?: Mock;\n }\n}\n\nexport const toHaveBeenRequestedWithHash: Assertion = {\n name: \"toHaveBeenRequestedWithHash\",\n interceptHttp:\n (mockFn, original) =>\n (path, resolver, options, ...rest) => {\n const hashAssertion = mockFn();\n hashAssertion.mockName(typeof path === \"string\" ? path : path.source);\n\n const newResolver: typeof resolver = (info, ...args) => {\n const { request } = info;\n const clone = request.clone();\n const hash = new URL(clone.url).hash;\n\n hashAssertion(hash);\n\n return resolver(info, ...args);\n };\n\n const handler = original(path, newResolver, options, ...rest);\n\n handler.hashAssertion = hashAssertion;\n\n return handler;\n },\n interceptGql:\n (mockFn, original) =>\n (operationName, resolver, options, ...rest) => {\n const hashAssertion = mockFn();\n hashAssertion.mockName(\n typeof operationName === \"string\"\n ? operationName\n : operationName.toString(),\n );\n\n const newResolver: typeof resolver = (info, ...args) => {\n const { request } = info;\n const clone = request.clone();\n const hash = new URL(clone.url).hash;\n\n hashAssertion(hash);\n\n return resolver(info, ...args);\n };\n\n const handler = original(operationName, newResolver, options, ...rest);\n\n handler.hashAssertion = hashAssertion;\n\n return handler;\n },\n assert: function (received, expected) {\n checkMockedHandler(received);\n const assertion = received.hashAssertion;\n if (!assertion) throw new Error(\"No hash assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n\n const { isNot } = this;\n return {\n pass: calls.some((call) => checkEquality(call[0], expected)),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${name} to${isNot ? \" not\" : \"\"} have been requested with hash ${this.utils.printExpected(expected)}`,\n ),\n };\n },\n};\n","import type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls, ordinalOf } from \"../../utils/formatMockCalls.js\";\n\nexport const toHaveBeenNthRequestedWithHeaders: Assertion = {\n name: \"toHaveBeenNthRequestedWithHeaders\",\n interceptHttp: (_mockFn, original) => original,\n interceptGql: (_mockFn, original) => original,\n assert: function (received, time, expected) {\n checkMockedHandler(received);\n const assertion = received.headersAssertion;\n if (!assertion) throw new Error(\"No headers assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n const nthCall = calls[time - 1]?.[0];\n\n const { isNot } = this;\n return {\n pass: checkEquality(nthCall, expected),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${name} to${isNot ? \" not\" : \"\"} have been requested the ${ordinalOf(time)} time with headers ${this.utils.printExpected(JSON.stringify(expected))}, but it was requested with ${this.utils.printReceived(JSON.stringify(nthCall))}`,\n ),\n };\n },\n};\n","import type { Mock } from \"vitest\";\nimport type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls } from \"../../utils/formatMockCalls.js\";\n\ndeclare module \"msw\" {\n interface HttpHandler {\n headersAssertion?: Mock;\n }\n interface GraphQLHandler {\n headersAssertion?: Mock;\n }\n}\n\nexport const toHaveBeenRequestedWithHeaders: Assertion = {\n name: \"toHaveBeenRequestedWithHeaders\",\n interceptHttp:\n (mockFn, original) =>\n (path, resolver, options, ...rest) => {\n const headersAssertion = mockFn();\n headersAssertion.mockName(typeof path === \"string\" ? path : path.source);\n\n const newResolver: typeof resolver = (info, ...args) => {\n const { request } = info;\n const clone = request.clone();\n\n headersAssertion(Object.fromEntries(clone.headers.entries()));\n\n return resolver(info, ...args);\n };\n\n const handler = original(path, newResolver, options, ...rest);\n\n handler.headersAssertion = headersAssertion;\n\n return handler;\n },\n interceptGql:\n (mockFn, original) =>\n (operationName, resolver, options, ...rest) => {\n const headersAssertion = mockFn();\n headersAssertion.mockName(\n typeof operationName === \"string\"\n ? operationName\n : operationName.toString(),\n );\n\n const newResolver: typeof resolver = (info, ...args) => {\n const { request } = info;\n const clone = request.clone();\n\n headersAssertion(Object.fromEntries(clone.headers.entries()));\n\n return resolver(info, ...args);\n };\n\n const handler = original(operationName, newResolver, options, ...rest);\n\n handler.headersAssertion = headersAssertion;\n\n return handler;\n },\n assert: function (received, expected) {\n checkMockedHandler(received);\n const assertion = received.headersAssertion;\n if (!assertion) throw new Error(\"No headers assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n\n const { isNot } = this;\n return {\n pass: calls.some((call) => checkEquality(call[0], expected)),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${name} to${isNot ? \" not\" : \"\"} have been requested with headers ${this.utils.printExpected(JSON.stringify(expected))}`,\n ),\n };\n },\n};\n","import type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls, ordinalOf } from \"../../utils/formatMockCalls.js\";\n\nexport const toHaveBeenNthRequestedWithJsonBody: Assertion = {\n name: \"toHaveBeenNthRequestedWithJsonBody\",\n interceptHttp: (_mockFn, original) => original,\n interceptGql: (_mockFn, original) => original,\n assert: function (received, time, expected) {\n checkMockedHandler(received);\n const assertion = received.jsonBodyAssertion;\n if (!assertion) throw new Error(\"No JSON body assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n const nthCall = calls[time - 1]?.[0];\n\n const { isNot } = this;\n return {\n pass: checkEquality(nthCall, expected),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${name} to${isNot ? \" not\" : \"\"} have been requested the ${ordinalOf(time)} time with JSON body ${this.utils.printExpected(JSON.stringify(expected))}, but it was requested with ${this.utils.printReceived(JSON.stringify(nthCall))}`,\n ),\n };\n },\n};\n","import type { HttpRequestHandler } from \"msw\";\nimport type { Mock } from \"vitest\";\nimport type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls } from \"../../utils/formatMockCalls.js\";\n\ndeclare module \"msw\" {\n interface HttpHandler {\n jsonBodyAssertion?: Mock;\n }\n interface GraphQLHandler {\n jsonBodyAssertion?: Mock;\n }\n}\n\nexport const toHaveBeenRequestedWithJsonBody: Assertion = {\n name: \"toHaveBeenRequestedWithJsonBody\",\n interceptHttp:\n (mockFn, original: HttpRequestHandler): HttpRequestHandler =>\n (path, resolver, options, ...rest) => {\n const jsonBodyAssertion = mockFn();\n jsonBodyAssertion.mockName(typeof path === \"string\" ? path : path.source);\n\n const newResolver: typeof resolver = async (info, ...args) => {\n const { request } = info;\n const clone = request.clone();\n try {\n const payload = await clone.json();\n jsonBodyAssertion(payload);\n } catch {\n jsonBodyAssertion(undefined);\n }\n\n return resolver(info, ...args);\n };\n\n const handler = original(path, newResolver, options, ...rest);\n\n handler.jsonBodyAssertion = jsonBodyAssertion;\n\n return handler;\n },\n interceptGql:\n (mockFn, original) =>\n (operationName, resolver, options, ...rest) => {\n const jsonBodyAssertion = mockFn();\n jsonBodyAssertion.mockName(\n typeof operationName === \"string\"\n ? operationName\n : operationName.toString(),\n );\n\n const newResolver: typeof resolver = async (info, ...args) => {\n const { request } = info;\n const clone = request.clone();\n try {\n const payload = await clone.json();\n jsonBodyAssertion(payload);\n } catch {\n jsonBodyAssertion(undefined);\n }\n\n return resolver(info, ...args);\n };\n\n const handler = original(operationName, newResolver, options, ...rest);\n\n handler.jsonBodyAssertion = jsonBodyAssertion;\n\n return handler;\n },\n assert: function (received, expected) {\n checkMockedHandler(received);\n const assertion = received.jsonBodyAssertion;\n if (!assertion) throw new Error(\"No JSON body assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n\n const { isNot } = this;\n return {\n pass: calls.some((call) => checkEquality(call[0], expected)),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${name} to${isNot ? \" not\" : \"\"} have been requested with JSON body ${this.utils.printExpected(JSON.stringify(expected))}`,\n ),\n };\n },\n};\n","import type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls, ordinalOf } from \"../../utils/formatMockCalls.js\";\n\nexport const toHaveBeenNthRequestedWithPathParameters: Assertion = {\n name: \"toHaveBeenNthRequestedWithPathParameters\",\n interceptHttp: (_mockFn, original) => original,\n interceptGql: (_mockFn, original) => original,\n assert: function (received, time, expected) {\n checkMockedHandler(received);\n const assertion = received.pathParametersAssertion;\n if (!assertion) throw new Error(\"No path parameters assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n const nthCall = calls[time - 1]?.[0];\n\n const { isNot } = this;\n return {\n pass: checkEquality(nthCall, expected),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${name} to${isNot ? \" not\" : \"\"} have been requested the ${ordinalOf(time)} time with path parameters ${this.utils.printExpected(JSON.stringify(expected))}, but it was requested with ${this.utils.printReceived(JSON.stringify(nthCall))}`,\n ),\n };\n },\n};\n","import type { Mock } from \"vitest\";\nimport type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls } from \"../../utils/formatMockCalls.js\";\n\ndeclare module \"msw\" {\n interface HttpHandler {\n pathParametersAssertion?: Mock;\n }\n interface GraphQLHandler {\n pathParametersAssertion?: Mock;\n }\n}\n\nexport const toHaveBeenRequestedWithPathParameters: Assertion = {\n name: \"toHaveBeenRequestedWithPathParameters\",\n interceptHttp:\n (mockFn, original) =>\n (path, resolver, options, ...rest) => {\n const pathParametersAssertion = mockFn();\n pathParametersAssertion.mockName(\n typeof path === \"string\" ? path : path.source,\n );\n\n const newResolver: typeof resolver = (info, ...args) => {\n const { params } = info;\n\n // There is a null prototype\n pathParametersAssertion(JSON.parse(JSON.stringify(params)));\n\n return resolver(info, ...args);\n };\n\n const handler = original(path, newResolver, options, ...rest);\n\n handler.pathParametersAssertion = pathParametersAssertion;\n\n return handler;\n },\n interceptGql:\n (mockFn, original) =>\n (operationName, resolver, options, ...rest) => {\n const pathParametersAssertion = mockFn();\n pathParametersAssertion.mockName(\n typeof operationName === \"string\"\n ? operationName\n : operationName.toString(),\n );\n\n const newResolver: typeof resolver = (info, ...args) => {\n const params = \"params\" in info ? info.params : {};\n\n // There is a null prototype\n pathParametersAssertion(JSON.parse(JSON.stringify(params)));\n\n return resolver(info, ...args);\n };\n\n const handler = original(operationName, newResolver, options, ...rest);\n\n handler.pathParametersAssertion = pathParametersAssertion;\n\n return handler;\n },\n assert: function (received, expected) {\n checkMockedHandler(received);\n const assertion = received.pathParametersAssertion;\n if (!assertion) throw new Error(\"No path parameters assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion?.mock.calls || [];\n\n const { isNot } = this;\n return {\n pass: calls.some((call) => checkEquality(call[0], expected)),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${name} to${isNot ? \" not\" : \"\"} have been requested with path parameters ${this.utils.printExpected(JSON.stringify(expected))}`,\n ),\n };\n },\n};\n","import type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls, ordinalOf } from \"../../utils/formatMockCalls.js\";\n\nexport const toHaveBeenNthRequestedWithQueryString: Assertion = {\n name: \"toHaveBeenNthRequestedWithQueryString\",\n interceptHttp: (_mockFn, original) => original,\n interceptGql: (_mockFn, original) => original,\n assert: function (received, time, expected) {\n checkMockedHandler(received);\n const assertion = received.queryStringAssertion;\n if (!assertion) throw new Error(\"No query string assertion found\");\n\n const calls = assertion.mock.calls;\n const nthCall = calls[time - 1]?.[0];\n\n const { isNot } = this;\n return {\n pass: checkEquality(nthCall, expected),\n message: () =>\n formatMockCalls(\n assertion.getMockName(),\n calls,\n `Expected ${assertion.getMockName()} to${isNot ? \" not\" : \"\"} have been requested the ${ordinalOf(time)} time with query string ${this.utils.printExpected(expected)}, but it was requested with ${this.utils.printReceived(nthCall)}`,\n ),\n };\n },\n};\n","import type { Mock } from \"vitest\";\nimport type { Assertion } from \"../../types/index.js\";\nimport { checkEquality } from \"../../utils/checkEquality.js\";\nimport { checkMockedHandler } from \"../../utils/checkMockedHandler.js\";\nimport { formatMockCalls } from \"../../utils/formatMockCalls.js\";\n\ndeclare module \"msw\" {\n interface HttpHandler {\n queryStringAssertion?: Mock;\n }\n interface GraphQLHandler {\n queryStringAssertion?: Mock;\n }\n}\n\nexport const toHaveBeenRequestedWithQueryString: Assertion = {\n name: \"toHaveBeenRequestedWithQueryString\",\n interceptHttp:\n (mockFn, original) =>\n (path, resolver, options, ...rest) => {\n const queryStringAssertion = mockFn();\n queryStringAssertion.mockName(\n typeof path === \"string\" ? path : path.source,\n );\n\n const newResolver: typeof resolver = (info, ...args) => {\n const { request } = info;\n const clone = request.clone();\n const search = new URL(clone.url).search;\n\n queryStringAssertion(search);\n\n return resolver(info, ...args);\n };\n\n const handler = original(path, newResolver, options, ...rest);\n\n handler.queryStringAssertion = queryStringAssertion;\n\n return handler;\n },\n interceptGql:\n (mockFn, original) =>\n (operationName, resolver, options, ...rest) => {\n const queryStringAssertion = mockFn();\n queryStringAssertion.mockName(\n typeof operationName === \"string\"\n ? operationName\n : operationName.toString(),\n );\n\n const newResolver: typeof resolver = (info, ...args) => {\n const { request } = info;\n const clone = request.clone();\n const search = new URL(clone.url).search;\n\n queryStringAssertion(search);\n\n return resolver(info, ...args);\n };\n\n const handler = original(operationName, newResolver, options, ...rest);\n\n handler.queryStringAssertion = queryStringAssertion;\n\n return handler;\n },\n assert: function (received, expected) {\n checkMockedHandler(received);\n const assertion = received.queryStringAssertion;\n if (!assertion) throw new Error(\"No query string assertion found\");\n\n const name = assertion.getMockName();\n const calls = assertion.mock.calls;\n\n const { isNot } = this;\n return {\n pass: calls.some((call) => checkEquality(call[0], expected)),\n message: () =>\n formatMockCalls(\n name,\n calls,\n `Expected ${name} to${isNot ? \" not\" : \"\"} have been requested with query string ${this.utils.printExpected(expected)}`,\n ),\n };\n },\n};\n","import { toHaveBeenRequested } from \"./toHaveBeenRequested/toHaveBeenRequested.js\";\nimport { toHaveBeenRequestedTimes } from \"./toHaveBeenRequested/toHaveBeenRequestedTimes.js\";\nimport { toHaveBeenNthRequestedWith } from \"./toHaveBeenRequestedWith/toHaveBeenNthRequestedWith.js\";\nimport { toHaveBeenRequestedWith } from \"./toHaveBeenRequestedWith/toHaveBeenRequestedWith.js\";\nimport { toHaveBeenNthRequestedWithBody } from \"./toHaveBeenRequestedWithBody/toHaveBeenNthRequestedWithBody.js\";\nimport { toHaveBeenRequestedWithBody } from \"./toHaveBeenRequestedWithBody/toHaveBeenRequestedWithBody.js\";\nimport { toHaveBeenNthRequestedWithGqlQuery } from \"./toHaveBeenRequestedWithGqlQuery/toHaveBeenNthRequestedWithGqlQuery.js\";\nimport { toHaveBeenRequestedWithGqlQuery } from \"./toHaveBeenRequestedWithGqlQuery/toHaveBeenRequestedWithGqlQuery.js\";\nimport { toHaveBeenNthRequestedWithGqlVariables } from \"./toHaveBeenRequestedWithGqlVariables/toHaveBeenNthRequestedWithGqlVariables.js\";\nimport { toHaveBeenRequestedWithGqlVariables } from \"./toHaveBeenRequestedWithGqlVariables/toHaveBeenRequestedWithGqlVariables.js\";\nimport { toHaveBeenNthRequestedWithHash } from \"./toHaveBeenRequestedWithHash/toHaveBeenNthRequestedWithHash.js\";\nimport { toHaveBeenRequestedWithHash } from \"./toHaveBeenRequestedWithHash/toHaveBeenRequestedWithHash.js\";\nimport { toHaveBeenNthRequestedWithHeaders } from \"./toHaveBeenRequestedWithHeaders/toHaveBeenNthRequestedWithHeaders.js\";\nimport { toHaveBeenRequestedWithHeaders } from \"./toHaveBeenRequestedWithHeaders/toHaveBeenRequestedWithHeaders.js\";\nimport { toHaveBeenNthRequestedWithJsonBody } from \"./toHaveBeenRequestedWithJsonBody/toHaveBeenNthRequestedWithJsonBody.js\";\nimport { toHaveBeenRequestedWithJsonBody } from \"./toHaveBeenRequestedWithJsonBody/toHaveBeenRequestedWithJsonBody.js\";\nimport { toHaveBeenNthRequestedWithPathParameters } from \"./toHaveBeenRequestedWithPathParameters/toHaveBeenNthRequestedWithPathParameters.js\";\nimport { toHaveBeenRequestedWithPathParameters } from \"./toHaveBeenRequestedWithPathParameters/toHaveBeenRequestedWithPathParameters.js\";\nimport { toHaveBeenNthRequestedWithQueryString } from \"./toHaveBeenRequestedWithQueryString/toHaveBeenNthRequestedWithQueryString.js\";\nimport { toHaveBeenRequestedWithQueryString } from \"./toHaveBeenRequestedWithQueryString/toHaveBeenRequestedWithQueryString.js\";\n\nexport const graphqlOnlyAssertions = [\n toHaveBeenRequestedWithGqlVariables,\n toHaveBeenNthRequestedWithGqlVariables,\n toHaveBeenRequestedWithGqlQuery,\n toHaveBeenNthRequestedWithGqlQuery,\n];\n\nexport const assertions = [\n toHaveBeenRequested,\n toHaveBeenRequestedTimes,\n toHaveBeenRequestedWith,\n toHaveBeenNthRequestedWith,\n toHaveBeenRequestedWithBody,\n toHaveBeenNthRequestedWithBody,\n toHaveBeenRequestedWithHash,\n toHaveBeenNthRequestedWithHash,\n toHaveBeenRequestedWithHeaders,\n toHaveBeenNthRequestedWithHeaders,\n toHaveBeenRequestedWithJsonBody,\n toHaveBeenNthRequestedWithJsonBody,\n toHaveBeenRequestedWithQueryString,\n toHaveBeenNthRequestedWithQueryString,\n toHaveBeenRequestedWithPathParameters,\n toHaveBeenNthRequestedWithPathParameters,\n];\n\nexport const httpAssert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