(callsUntilSucceed: number)
| 102 | } |
| 103 | |
| 104 | private fnGenerator(callsUntilSucceed: number): () => Promise<string> { |
| 105 | return (() => { |
| 106 | this.callCount++; |
| 107 | if (this.callCount === callsUntilSucceed) { |
| 108 | return Promise.resolve(this.expectedResolve); |
| 109 | } |
| 110 | return Promise.reject(this.expectedReject); |
| 111 | }).bind(this); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | (new PromiseUtilsTests()).runTests(); |