blob: 11590fdcd39cb83a93da0d08e1b054231744071c [file] [log] [blame]
{"version":3,"sources":["packages/common/common-http-testing.umd.js"],"names":["global","factory","exports","module","require","define","amd","self","ng","common","http","testing","core","rxjs","this","HttpTestingController","TestRequest","request","observer","_cancelled","Object","defineProperty","prototype","get","enumerable","configurable","flush","body","opts","cancelled","Error","url","urlWithParams","headers","HttpHeaders","_maybeConvertBody","responseType","_toArrayBufferBody","ArrayBuffer","_toBlob","Blob","_toJsonBody","_toTextBody","JSON","stringify","statusText","status","undefined","next","HttpResponse","complete","error","HttpErrorResponse","event","format","Array","isArray","HttpClientTestingModule","HttpClientTestingBackend","open","handle","req","_this","Observable","testReq","push","type","HttpEventType","Sent","_match","match","filter","method","toUpperCase","results","forEach","result","index","indexOf","splice","expectOne","description","descriptionFromMatcher","matches","length","message","map","join","expectNone","verify","ignoreCancelled","requests","split","matcher","name","decorators","Injectable","NgModule","args","imports","HttpClientModule","providers","provide","HttpBackend","useExisting","ɵangular_packages_common_http_testing_testing_a","value"],"mappings":";;;;;CAMC,SAAUA,EAAQC,GACI,iBAAZC,SAA0C,oBAAXC,OAAyBF,EAAQC,QAASE,QAAQ,wBAAyBA,QAAQ,iBAAkBA,QAAQ,SACjI,mBAAXC,QAAyBA,OAAOC,IAAMD,OAAO,+BAAgC,CAAC,UAAW,uBAAwB,gBAAiB,QAASJ,GACxHA,IAAzBD,EAASA,GAAUO,MAAsBC,GAAKR,EAAOQ,IAAM,GAAIR,EAAOQ,GAAGC,OAAST,EAAOQ,GAAGC,QAAU,GAAIT,EAAOQ,GAAGC,OAAOC,KAAOV,EAAOQ,GAAGC,OAAOC,MAAQ,GAAIV,EAAOQ,GAAGC,OAAOC,KAAKC,QAAU,IAAKX,EAAOQ,GAAGC,OAAOC,KAAMV,EAAOQ,GAAGI,KAAMZ,EAAOa,MAHvP,CAIEC,MAAM,SAAWZ,EAASQ,EAAME,EAAMC,GAAQ;;;;;;;OAe5C,IAAIE,EACA,SAASA,MAoBTC,EAA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jC,EAAyBpC,UAAU4D,uBAAyB,SAAUW,GAClE,MAAuB,iBAAZA,EACA,cAAgBA,EAEC,iBAAZA,EAGL,kBAFMA,EAAQrB,QAAU,SAEI,WADzBqB,EAAQ9D,KAAO,SAIlB,sBAAwB8D,EAAQC,MAGxCpC,EA/HkC,GAiI7CA,EAAyBqC,WAAa,CAClC,CAAE7B,KAAMtD,EAAKoF,cAiBbvC,EACA,SAASA,OAIWsC,WAAa,CACjC,CAAE7B,KAAMtD,EAAKqF,SAAUC,KAAM,CAAC,CAClBC,QAAS,CACLzF,EAAK0F,kBAETC,UAAW,CACP3C,EACA,CAAE4C,QAAS5F,EAAK6F,YAAaC,YAAa9C,GAC1C,CAAE4C,QAASvF,EAAuByF,YAAa9C;;;;;;;;;;;;;;;AAyBnExD,EAAQuD,wBAA0BA,EAClCvD,EAAQa,sBAAwBA,EAChCb,EAAQc,YAAcA,EACtBd,EAAQuG,gDAAkD/C,EAE1DtC,OAAOC,eAAenB,EAAS,aAAc,CAAEwG,OAAO","sourcesContent":["/**\n * @license Angular v11.2.14\n * (c) 2010-2021 Google LLC. https://angular.io/\n * License: MIT\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@angular/core'), require('rxjs')) :\n typeof define === 'function' && define.amd ? define('@angular/common/http/testing', ['exports', '@angular/common/http', '@angular/core', 'rxjs'], factory) :\n (global = global || self, factory((global.ng = global.ng || {}, global.ng.common = global.ng.common || {}, global.ng.common.http = global.ng.common.http || {}, global.ng.common.http.testing = {}), global.ng.common.http, global.ng.core, global.rxjs));\n}(this, (function (exports, http, core, rxjs) { 'use strict';\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /**\n * Controller to be injected into tests, that allows for mocking and flushing\n * of requests.\n *\n * @publicApi\n */\n var HttpTestingController = /** @class */ (function () {\n function HttpTestingController() {\n }\n return HttpTestingController;\n }());\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /**\n * A mock requests that was received and is ready to be answered.\n *\n * This interface allows access to the underlying `HttpRequest`, and allows\n * responding with `HttpEvent`s or `HttpErrorResponse`s.\n *\n * @publicApi\n */\n var TestRequest = /** @class */ (function () {\n function TestRequest(request, observer) {\n this.request = request;\n this.observer = observer;\n /**\n * @internal set by `HttpClientTestingBackend`\n */\n this._cancelled = false;\n }\n Object.defineProperty(TestRequest.prototype, \"cancelled\", {\n /**\n * Whether the request was cancelled after it was sent.\n */\n get: function () {\n return this._cancelled;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Resolve the request by returning a body plus additional HTTP information (such as response\n * headers) if provided.\n * If the request specifies an expected body type, the body is converted into the requested type.\n * Otherwise, the body is converted to `JSON` by default.\n *\n * Both successful and unsuccessful responses can be delivered via `flush()`.\n */\n TestRequest.prototype.flush = function (body, opts) {\n if (opts === void 0) { opts = {}; }\n if (this.cancelled) {\n throw new Error(\"Cannot flush a cancelled request.\");\n }\n var url = this.request.urlWithParams;\n var headers = (opts.headers instanceof http.HttpHeaders) ? opts.headers : new http.HttpHeaders(opts.headers);\n body = _maybeConvertBody(this.request.responseType, body);\n var statusText = opts.statusText;\n var status = opts.status !== undefined ? opts.status : 200;\n if (opts.status === undefined) {\n if (body === null) {\n status = 204;\n statusText = statusText || 'No Content';\n }\n else {\n statusText = statusText || 'OK';\n }\n }\n if (statusText === undefined) {\n throw new Error('statusText is required when setting a custom status.');\n }\n if (status >= 200 && status < 300) {\n this.observer.next(new http.HttpResponse({ body: body, headers: headers, status: status, statusText: statusText, url: url }));\n this.observer.complete();\n }\n else {\n this.observer.error(new http.HttpErrorResponse({ error: body, headers: headers, status: status, statusText: statusText, url: url }));\n }\n };\n /**\n * Resolve the request by returning an `ErrorEvent` (e.g. simulating a network failure).\n */\n TestRequest.prototype.error = function (error, opts) {\n if (opts === void 0) { opts = {}; }\n if (this.cancelled) {\n throw new Error(\"Cannot return an error for a cancelled request.\");\n }\n if (opts.status && opts.status >= 200 && opts.status < 300) {\n throw new Error(\"error() called with a successful status.\");\n }\n var headers = (opts.headers instanceof http.HttpHeaders) ? opts.headers : new http.HttpHeaders(opts.headers);\n this.observer.error(new http.HttpErrorResponse({\n error: error,\n headers: headers,\n status: opts.status || 0,\n statusText: opts.statusText || '',\n url: this.request.urlWithParams,\n }));\n };\n /**\n * Deliver an arbitrary `HttpEvent` (such as a progress event) on the response stream for this\n * request.\n */\n TestRequest.prototype.event = function (event) {\n if (this.cancelled) {\n throw new Error(\"Cannot send events to a cancelled request.\");\n }\n this.observer.next(event);\n };\n return TestRequest;\n }());\n /**\n * Helper function to convert a response body to an ArrayBuffer.\n */\n function _toArrayBufferBody(body) {\n if (typeof ArrayBuffer === 'undefined') {\n throw new Error('ArrayBuffer responses are not supported on this platform.');\n }\n if (body instanceof ArrayBuffer) {\n return body;\n }\n throw new Error('Automatic conversion to ArrayBuffer is not supported for response type.');\n }\n /**\n * Helper function to convert a response body to a Blob.\n */\n function _toBlob(body) {\n if (typeof Blob === 'undefined') {\n throw new Error('Blob responses are not supported on this platform.');\n }\n if (body instanceof Blob) {\n return body;\n }\n if (ArrayBuffer && body instanceof ArrayBuffer) {\n return new Blob([body]);\n }\n throw new Error('Automatic conversion to Blob is not supported for response type.');\n }\n /**\n * Helper function to convert a response body to JSON data.\n */\n function _toJsonBody(body, format) {\n if (format === void 0) { format = 'JSON'; }\n if (typeof ArrayBuffer !== 'undefined' && body instanceof ArrayBuffer) {\n throw new Error(\"Automatic conversion to \" + format + \" is not supported for ArrayBuffers.\");\n }\n if (typeof Blob !== 'undefined' && body instanceof Blob) {\n throw new Error(\"Automatic conversion to \" + format + \" is not supported for Blobs.\");\n }\n if (typeof body === 'string' || typeof body === 'number' || typeof body === 'object' ||\n typeof body === 'boolean' || Array.isArray(body)) {\n return body;\n }\n throw new Error(\"Automatic conversion to \" + format + \" is not supported for response type.\");\n }\n /**\n * Helper function to convert a response body to a string.\n */\n function _toTextBody(body) {\n if (typeof body === 'string') {\n return body;\n }\n if (typeof ArrayBuffer !== 'undefined' && body instanceof ArrayBuffer) {\n throw new Error('Automatic conversion to text is not supported for ArrayBuffers.');\n }\n if (typeof Blob !== 'undefined' && body instanceof Blob) {\n throw new Error('Automatic conversion to text is not supported for Blobs.');\n }\n return JSON.stringify(_toJsonBody(body, 'text'));\n }\n /**\n * Convert a response body to the requested type.\n */\n function _maybeConvertBody(responseType, body) {\n if (body === null) {\n return null;\n }\n switch (responseType) {\n case 'arraybuffer':\n return _toArrayBufferBody(body);\n case 'blob':\n return _toBlob(body);\n case 'json':\n return _toJsonBody(body);\n case 'text':\n return _toTextBody(body);\n default:\n throw new Error(\"Unsupported responseType: \" + responseType);\n }\n }\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /**\n * A testing backend for `HttpClient` which both acts as an `HttpBackend`\n * and as the `HttpTestingController`.\n *\n * `HttpClientTestingBackend` works by keeping a list of all open requests.\n * As requests come in, they're added to the list. Users can assert that specific\n * requests were made and then flush them. In the end, a verify() method asserts\n * that no unexpected requests were made.\n *\n *\n */\n var HttpClientTestingBackend = /** @class */ (function () {\n function HttpClientTestingBackend() {\n /**\n * List of pending requests which have not yet been expected.\n */\n this.open = [];\n }\n /**\n * Handle an incoming request by queueing it in the list of open requests.\n */\n HttpClientTestingBackend.prototype.handle = function (req) {\n var _this = this;\n return new rxjs.Observable(function (observer) {\n var testReq = new TestRequest(req, observer);\n _this.open.push(testReq);\n observer.next({ type: http.HttpEventType.Sent });\n return function () {\n testReq._cancelled = true;\n };\n });\n };\n /**\n * Helper function to search for requests in the list of open requests.\n */\n HttpClientTestingBackend.prototype._match = function (match) {\n if (typeof match === 'string') {\n return this.open.filter(function (testReq) { return testReq.request.urlWithParams === match; });\n }\n else if (typeof match === 'function') {\n return this.open.filter(function (testReq) { return match(testReq.request); });\n }\n else {\n return this.open.filter(function (testReq) { return (!match.method || testReq.request.method === match.method.toUpperCase()) &&\n (!match.url || testReq.request.urlWithParams === match.url); });\n }\n };\n /**\n * Search for requests in the list of open requests, and return all that match\n * without asserting anything about the number of matches.\n */\n HttpClientTestingBackend.prototype.match = function (match) {\n var _this = this;\n var results = this._match(match);\n results.forEach(function (result) {\n var index = _this.open.indexOf(result);\n if (index !== -1) {\n _this.open.splice(index, 1);\n }\n });\n return results;\n };\n /**\n * Expect that a single outstanding request matches the given matcher, and return\n * it.\n *\n * Requests returned through this API will no longer be in the list of open requests,\n * and thus will not match twice.\n */\n HttpClientTestingBackend.prototype.expectOne = function (match, description) {\n description = description || this.descriptionFromMatcher(match);\n var matches = this.match(match);\n if (matches.length > 1) {\n throw new Error(\"Expected one matching request for criteria \\\"\" + description + \"\\\", found \" + matches.length + \" requests.\");\n }\n if (matches.length === 0) {\n var message = \"Expected one matching request for criteria \\\"\" + description + \"\\\", found none.\";\n if (this.open.length > 0) {\n // Show the methods and URLs of open requests in the error, for convenience.\n var requests = this.open\n .map(function (testReq) {\n var url = testReq.request.urlWithParams;\n var method = testReq.request.method;\n return method + \" \" + url;\n })\n .join(', ');\n message += \" Requests received are: \" + requests + \".\";\n }\n throw new Error(message);\n }\n return matches[0];\n };\n /**\n * Expect that no outstanding requests match the given matcher, and throw an error\n * if any do.\n */\n HttpClientTestingBackend.prototype.expectNone = function (match, description) {\n description = description || this.descriptionFromMatcher(match);\n var matches = this.match(match);\n if (matches.length > 0) {\n throw new Error(\"Expected zero matching requests for criteria \\\"\" + description + \"\\\", found \" + matches.length + \".\");\n }\n };\n /**\n * Validate that there are no outstanding requests.\n */\n HttpClientTestingBackend.prototype.verify = function (opts) {\n if (opts === void 0) { opts = {}; }\n var open = this.open;\n // It's possible that some requests may be cancelled, and this is expected.\n // The user can ask to ignore open requests which have been cancelled.\n if (opts.ignoreCancelled) {\n open = open.filter(function (testReq) { return !testReq.cancelled; });\n }\n if (open.length > 0) {\n // Show the methods and URLs of open requests in the error, for convenience.\n var requests = open.map(function (testReq) {\n var url = testReq.request.urlWithParams.split('?')[0];\n var method = testReq.request.method;\n return method + \" \" + url;\n })\n .join(', ');\n throw new Error(\"Expected no open requests, found \" + open.length + \": \" + requests);\n }\n };\n HttpClientTestingBackend.prototype.descriptionFromMatcher = function (matcher) {\n if (typeof matcher === 'string') {\n return \"Match URL: \" + matcher;\n }\n else if (typeof matcher === 'object') {\n var method = matcher.method || '(any)';\n var url = matcher.url || '(any)';\n return \"Match method: \" + method + \", URL: \" + url;\n }\n else {\n return \"Match by function: \" + matcher.name;\n }\n };\n return HttpClientTestingBackend;\n }());\n HttpClientTestingBackend.decorators = [\n { type: core.Injectable }\n ];\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /**\n * Configures `HttpClientTestingBackend` as the `HttpBackend` used by `HttpClient`.\n *\n * Inject `HttpTestingController` to expect and flush requests in your tests.\n *\n * @publicApi\n */\n var HttpClientTestingModule = /** @class */ (function () {\n function HttpClientTestingModule() {\n }\n return HttpClientTestingModule;\n }());\n HttpClientTestingModule.decorators = [\n { type: core.NgModule, args: [{\n imports: [\n http.HttpClientModule,\n ],\n providers: [\n HttpClientTestingBackend,\n { provide: http.HttpBackend, useExisting: HttpClientTestingBackend },\n { provide: HttpTestingController, useExisting: HttpClientTestingBackend },\n ],\n },] }\n ];\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n /**\n * Generated bundle index. Do not edit.\n */\n\n exports.HttpClientTestingModule = HttpClientTestingModule;\n exports.HttpTestingController = HttpTestingController;\n exports.TestRequest = TestRequest;\n exports.ɵangular_packages_common_http_testing_testing_a = HttpClientTestingBackend;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n//# sourceMappingURL=common-http-testing.umd.js.map\n"]}