( predicate: () => boolean, timeoutMs = 250, )
| 174 | } |
| 175 | |
| 176 | async function waitFor( |
| 177 | predicate: () => boolean, |
| 178 | timeoutMs = 250, |
| 179 | ): Promise<void> { |
| 180 | const startedAt = Date.now(); |
| 181 | while (Date.now() - startedAt < timeoutMs) { |
| 182 | if (predicate()) { |
| 183 | return; |
| 184 | } |
| 185 | await sleep(5); |
| 186 | } |
| 187 | assert.equal(predicate(), true); |
| 188 | } |
| 189 | |
| 190 | test("resilient channel keeps handlers after rebuild", async () => { |
| 191 | const { channel, channels } = createHarness(); |
no test coverage detected