MCPcopy Create free account
hub / github.com/angular/dev-infra / mockDispatch

Function mockDispatch

github-actions/saucelabs/set-saucelabs-env.js:11074–11117  ·  view source on GitHub ↗
(opts, handler)

Source from the content-addressed store, hash-verified

11072 body,
11073 headers,
11074 query
11075 };
11076 }
11077 function generateKeyValues(data) {
11078 const keys = Object.keys(data);
11079 const result = [];
11080 for (let i = 0; i < keys.length; ++i) {
11081 const key = keys[i];
11082 const value = data[key];
11083 const name = Buffer.from(`${key}`);
11084 if (Array.isArray(value)) {
11085 for (let j = 0; j < value.length; ++j) {
11086 result.push(name, Buffer.from(`${value[j]}`));
11087 }
11088 } else {
11089 result.push(name, Buffer.from(`${value}`));
11090 }
11091 }
11092 return result;
11093 }
11094 function getStatusText(statusCode) {
11095 return STATUS_CODES[statusCode] || "unknown";
11096 }
11097 function getResponse(body) {
11098 return __async(this, null, function* () {
11099 const buffers = [];
11100 try {
11101 for (var iter = __forAwait(body), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
11102 const data = temp.value;
11103 buffers.push(data);
11104 }
11105 } catch (temp) {
11106 error = [temp];
11107 } finally {
11108 try {
11109 more && (temp = iter.return) && (yield temp.call(iter));
11110 } finally {
11111 if (error)
11112 throw error[0];
11113 }
11114 }
11115 return Buffer.concat(buffers).toString("utf8");
11116 });
11117 }
11118 function mockDispatch(opts, handler) {
11119 const key = buildKey(opts);
11120 const mockDispatch2 = getMockDispatch(this[kDispatches], key);

Callers

nothing calls this directly

Calls 8

buildKeyFunction · 0.70
getMockDispatchFunction · 0.70
__spreadValuesFunction · 0.70
deleteMockDispatchFunction · 0.70
setTimeoutFunction · 0.70
handleReplyFunction · 0.70
callbackMethod · 0.45
onErrorMethod · 0.45

Tested by

no test coverage detected