{
  "type": "module",
  "source": "doc/api/api-mockcallhistory.md",
  "modules": [
    {
      "textRaw": "Class: MockCallHistory",
      "name": "class:_mockcallhistory",
      "type": "module",
      "desc": "<p>Access to an instance with :</p>\n<pre><code class=\"language-js\">const mockAgent = new MockAgent({ enableCallHistory: true })\nmockAgent.getCallHistory()\n\n// or\nconst mockAgent = new MockAgent()\nmockAgent.enableMockHistory()\nmockAgent.getCallHistory()\n\n</code></pre>\n<p>a MockCallHistory instance implements a <strong>Symbol.iterator</strong> letting you iterate on registered logs :</p>\n<pre><code class=\"language-ts\">for (const log of mockAgent.getCallHistory()) {\n  //...\n}\n\nconst array: Array&#x3C;MockCallHistoryLog> = [...mockAgent.getCallHistory()]\nconst set: Set&#x3C;MockCallHistoryLog> = new Set(mockAgent.getCallHistory())\n</code></pre>",
      "modules": [
        {
          "textRaw": "class methods",
          "name": "class_methods",
          "type": "module",
          "modules": [
            {
              "textRaw": "clear",
              "name": "clear",
              "type": "module",
              "desc": "<p>Clear all MockCallHistoryLog registered. This is automatically done when calling <code>mockAgent.close()</code></p>\n<pre><code class=\"language-js\">mockAgent.clearCallHistory()\n// same as\nmockAgent.getCallHistory()?.clear()\n</code></pre>",
              "displayName": "clear"
            },
            {
              "textRaw": "calls",
              "name": "calls",
              "type": "module",
              "desc": "<p>Get all MockCallHistoryLog registered as an array</p>\n<pre><code class=\"language-js\">mockAgent.getCallHistory()?.calls()\n</code></pre>",
              "displayName": "calls"
            },
            {
              "textRaw": "firstCall",
              "name": "firstcall",
              "type": "module",
              "desc": "<p>Get the first MockCallHistoryLog registered or undefined</p>\n<pre><code class=\"language-js\">mockAgent.getCallHistory()?.firstCall()\n</code></pre>",
              "displayName": "firstCall"
            },
            {
              "textRaw": "lastCall",
              "name": "lastcall",
              "type": "module",
              "desc": "<p>Get the last MockCallHistoryLog registered or undefined</p>\n<pre><code class=\"language-js\">mockAgent.getCallHistory()?.lastCall()\n</code></pre>",
              "displayName": "lastCall"
            },
            {
              "textRaw": "nthCall",
              "name": "nthcall",
              "type": "module",
              "desc": "<p>Get the nth MockCallHistoryLog registered or undefined</p>\n<pre><code class=\"language-js\">mockAgent.getCallHistory()?.nthCall(3) // the third MockCallHistoryLog registered\n</code></pre>",
              "displayName": "nthCall"
            },
            {
              "textRaw": "filterCallsByProtocol",
              "name": "filtercallsbyprotocol",
              "type": "module",
              "desc": "<p>Filter MockCallHistoryLog by protocol.</p>\n<blockquote>\n<p>more details for the first parameter can be found <a href=\"/docs/docs/api/MockCallHistory.html#filter-parameter\">here</a></p>\n</blockquote>\n<pre><code class=\"language-js\">mockAgent.getCallHistory()?.filterCallsByProtocol(/https/)\nmockAgent.getCallHistory()?.filterCallsByProtocol('https:')\n</code></pre>",
              "displayName": "filterCallsByProtocol"
            },
            {
              "textRaw": "filterCallsByHost",
              "name": "filtercallsbyhost",
              "type": "module",
              "desc": "<p>Filter MockCallHistoryLog by host.</p>\n<blockquote>\n<p>more details for the first parameter can be found <a href=\"/docs/docs/api/MockCallHistory.html#filter-parameter\">here</a></p>\n</blockquote>\n<pre><code class=\"language-js\">mockAgent.getCallHistory()?.filterCallsByHost(/localhost/)\nmockAgent.getCallHistory()?.filterCallsByHost('localhost:3000')\n</code></pre>",
              "displayName": "filterCallsByHost"
            },
            {
              "textRaw": "filterCallsByPort",
              "name": "filtercallsbyport",
              "type": "module",
              "desc": "<p>Filter MockCallHistoryLog by port.</p>\n<blockquote>\n<p>more details for the first parameter can be found <a href=\"/docs/docs/api/MockCallHistory.html#filter-parameter\">here</a></p>\n</blockquote>\n<pre><code class=\"language-js\">mockAgent.getCallHistory()?.filterCallsByPort(/3000/)\nmockAgent.getCallHistory()?.filterCallsByPort('3000')\nmockAgent.getCallHistory()?.filterCallsByPort('')\n</code></pre>",
              "displayName": "filterCallsByPort"
            },
            {
              "textRaw": "filterCallsByOrigin",
              "name": "filtercallsbyorigin",
              "type": "module",
              "desc": "<p>Filter MockCallHistoryLog by origin.</p>\n<blockquote>\n<p>more details for the first parameter can be found <a href=\"/docs/docs/api/MockCallHistory.html#filter-parameter\">here</a></p>\n</blockquote>\n<pre><code class=\"language-js\">mockAgent.getCallHistory()?.filterCallsByOrigin(/http:\\/\\/localhost:3000/)\nmockAgent.getCallHistory()?.filterCallsByOrigin('http://localhost:3000')\n</code></pre>",
              "displayName": "filterCallsByOrigin"
            },
            {
              "textRaw": "filterCallsByPath",
              "name": "filtercallsbypath",
              "type": "module",
              "desc": "<p>Filter MockCallHistoryLog by path.</p>\n<blockquote>\n<p>more details for the first parameter can be found <a href=\"/docs/docs/api/MockCallHistory.html#filter-parameter\">here</a></p>\n</blockquote>\n<pre><code class=\"language-js\">mockAgent.getCallHistory()?.filterCallsByPath(/api\\/v1\\/graphql/)\nmockAgent.getCallHistory()?.filterCallsByPath('/api/v1/graphql')\n</code></pre>",
              "displayName": "filterCallsByPath"
            },
            {
              "textRaw": "filterCallsByHash",
              "name": "filtercallsbyhash",
              "type": "module",
              "desc": "<p>Filter MockCallHistoryLog by hash.</p>\n<blockquote>\n<p>more details for the first parameter can be found <a href=\"/docs/docs/api/MockCallHistory.html#filter-parameter\">here</a></p>\n</blockquote>\n<pre><code class=\"language-js\">mockAgent.getCallHistory()?.filterCallsByPath(/hash/)\nmockAgent.getCallHistory()?.filterCallsByPath('#hash')\n</code></pre>",
              "displayName": "filterCallsByHash"
            },
            {
              "textRaw": "filterCallsByFullUrl",
              "name": "filtercallsbyfullurl",
              "type": "module",
              "desc": "<p>Filter MockCallHistoryLog by fullUrl. fullUrl contains protocol, host, port, path, hash, and query params</p>\n<blockquote>\n<p>more details for the first parameter can be found <a href=\"/docs/docs/api/MockCallHistory.html#filter-parameter\">here</a></p>\n</blockquote>\n<pre><code class=\"language-js\">mockAgent.getCallHistory()?.filterCallsByFullUrl(/https:\\/\\/localhost:3000\\/\\?query=value#hash/)\nmockAgent.getCallHistory()?.filterCallsByFullUrl('https://localhost:3000/?query=value#hash')\n</code></pre>",
              "displayName": "filterCallsByFullUrl"
            },
            {
              "textRaw": "filterCallsByMethod",
              "name": "filtercallsbymethod",
              "type": "module",
              "desc": "<p>Filter MockCallHistoryLog by method.</p>\n<blockquote>\n<p>more details for the first parameter can be found <a href=\"/docs/docs/api/MockCallHistory.html#filter-parameter\">here</a></p>\n</blockquote>\n<pre><code class=\"language-js\">mockAgent.getCallHistory()?.filterCallsByMethod(/POST/)\nmockAgent.getCallHistory()?.filterCallsByMethod('POST')\n</code></pre>",
              "displayName": "filterCallsByMethod"
            },
            {
              "textRaw": "filterCalls",
              "name": "filtercalls",
              "type": "module",
              "desc": "<p>This class method is a meta function / alias to apply complex filtering in a single way.</p>\n<p>Parameters :</p>\n<ul>\n<li>criteria : the first parameter. a function, regexp or object.\n<ul>\n<li>function : filter MockCallHistoryLog when the function returns false</li>\n<li>regexp : filter MockCallHistoryLog when the regexp does not match on MockCallHistoryLog.toString() (<a href=\"/docs/docs/api/MockCallHistoryLog.html#to-string\">see</a>)</li>\n<li>object : an object with MockCallHistoryLog properties as keys to apply multiple filters. each values are a <a href=\"/docs/docs/api/MockCallHistory.html#filter-parameter\">filter parameter</a></li>\n</ul>\n</li>\n<li>options : the second parameter. an object.\n<ul>\n<li>options.operator : <code>'AND'</code> or <code>'OR'</code> (default <code>'OR'</code>). Used only if criteria is an object. see below</li>\n</ul>\n</li>\n</ul>\n<pre><code class=\"language-js\">mockAgent.getCallHistory()?.filterCalls((log) => log.hash === value &#x26;&#x26; log.headers?.['authorization'] !== undefined)\nmockAgent.getCallHistory()?.filterCalls(/\"data\": \"{ \"errors\": \"wrong body\" }\"/)\n\n// returns an Array of MockCallHistoryLog which all have\n// - a hash containing my-hash\n// - OR\n// - a path equal to /endpoint\nmockAgent.getCallHistory()?.filterCalls({ hash: /my-hash/, path: '/endpoint' })\n\n// returns an Array of MockCallHistoryLog which all have\n// - a hash containing my-hash\n// - AND\n// - a path equal to /endpoint\nmockAgent.getCallHistory()?.filterCalls({ hash: /my-hash/, path: '/endpoint' }, { operator: 'AND' })\n</code></pre>",
              "displayName": "filterCalls"
            }
          ],
          "displayName": "class methods"
        },
        {
          "textRaw": "filter parameter",
          "name": "filter_parameter",
          "type": "module",
          "desc": "<p>Can be :</p>\n<ul>\n<li>string. MockCallHistoryLog filtered if <code>value !== parameterValue</code></li>\n<li>null. MockCallHistoryLog filtered if <code>value !== parameterValue</code></li>\n<li>undefined. MockCallHistoryLog filtered if <code>value !== parameterValue</code></li>\n<li>regexp. MockCallHistoryLog filtered if <code>!parameterValue.test(value)</code></li>\n</ul>",
          "displayName": "filter parameter"
        }
      ],
      "displayName": "Class: MockCallHistory"
    }
  ]
}