(result, method)
| 60 | } |
| 61 | |
| 62 | async runForLoopAsync(result, method) { |
| 63 | { |
| 64 | const hook = this.createHook([], `${method}BrokenPromise`); |
| 65 | hook.tapPromise("promise", () => "this is not a promise"); |
| 66 | result[`${method}BrokenPromise`] = await this.gainResult((cb) => |
| 67 | hook[method](cb) |
| 68 | ); |
| 69 | } |
| 70 | { |
| 71 | const hook = this.createHook([], `${method}SinglePromise`); |
| 72 | hook.tapPromise("promise", () => { |
| 73 | result[`${method}SinglePromiseCalled`] = |
| 74 | (result[`${method}SinglePromiseCalled`] || 0) + 1; |
| 75 | if (result[`${method}SinglePromiseCalled`] < 42) { |
| 76 | return Promise.resolve().then(() => true); |
| 77 | } |
| 78 | return Promise.resolve().then(() => {}); |
| 79 | }); |
| 80 | result[`${method}SinglePromise`] = await this.gainResult((cb) => |
| 81 | hook[method](cb) |
| 82 | ); |
| 83 | } |
| 84 | |
| 85 | { |
| 86 | const hook = this.createHook([], `${method}MultiplePromise`); |
| 87 | hook.tapPromise("promise1", () => { |
| 88 | result[`${method}MultiplePromiseCalled1`] = |
| 89 | (result[`${method}MultiplePromiseCalled1`] || 0) + 1; |
| 90 | if (result[`${method}MultiplePromiseCalled1`] < 42) { |
| 91 | return Promise.resolve().then(() => true); |
| 92 | } |
| 93 | return Promise.resolve().then(() => {}); |
| 94 | }); |
| 95 | hook.tapPromise("promise2", () => { |
| 96 | result[`${method}MultiplePromiseCalled2`] = |
| 97 | (result[`${method}MultiplePromiseCalled2`] || 0) + 1; |
| 98 | if (result[`${method}MultiplePromiseCalled2`] < 42) { |
| 99 | return Promise.resolve().then(() => true); |
| 100 | } |
| 101 | return Promise.resolve().then(() => {}); |
| 102 | }); |
| 103 | result[`${method}MultiplePromise`] = await this.gainResult((cb) => |
| 104 | hook[method](cb) |
| 105 | ); |
| 106 | } |
| 107 | |
| 108 | { |
| 109 | const hook = this.createHook([], `${method}SingleAsync`); |
| 110 | hook.tapAsync("async", (callback) => { |
| 111 | result[`${method}SingleAsyncCalled`] = |
| 112 | (result[`${method}SingleAsyncCalled`] || 0) + 1; |
| 113 | if (result[`${method}SingleAsyncCalled`] < 42) { |
| 114 | return Promise.resolve().then(() => callback(null, true)); |
| 115 | } |
| 116 | return Promise.resolve().then(() => callback()); |
| 117 | }); |
| 118 | result[`${method}SingleAsync`] = await this.gainResult((cb) => |
| 119 | hook[method](cb) |
no test coverage detected