Have drop() name the event a lost link warrants, and name requestOnCurrentLink() for what it does
Mirror / push (push) Successful in 6s
Test / test (18) (pull_request) Successful in 31s
Test / test (24) (pull_request) Successful in 31s
Test / test (26) (pull_request) Successful in 31s
Test / lint (pull_request) Successful in 26s
Test / test (20) (pull_request) Successful in 31s
Test / test (22) (pull_request) Successful in 31s

This commit is contained in:
2026-09-28 21:31:48 +02:00
parent 2152b995d4
commit fe320d23a8
5 changed files with 27 additions and 17 deletions
+6 -5
View File
@@ -1460,19 +1460,20 @@ describe('LinkLife', () => {
assert.match(link.refusal()?.message ?? '', /closed/, 'stopped while down');
link.end();
assert.equal(link.awaitsNextLink(), false, 'ended');
assert.equal(new LinkLife({ log: silentLog, reconnects: false, timeout: 100 }).drop(), true);
});
test('drops an attached link once, and counts each drop', () => {
test('drops an attached link once, counts each drop, and names the event it warrants', () => {
const link = new LinkLife({ log: silentLog, reconnects: true, timeout: 100 });
const generation = link.generation();
assert.equal(link.drop(), true);
assert.equal(link.drop(), false, 'already down');
assert.equal(link.drop(), 'disconnected');
assert.equal(link.drop(), undefined, 'already down');
assert.equal(link.generation(), generation + 1);
link.attach();
assert.equal(link.drop(), true, 'a new link drops again');
link.stop();
assert.equal(link.drop(), 'close', 'a new link drops again, with none to follow it');
assert.equal(link.generation(), generation + 2);
assert.equal(new LinkLife({ log: silentLog, reconnects: false, timeout: 100 }).drop(), 'close');
});
test('releases a held request with the reason once the link ends', async () => {