Refine subscription import and refresh flow
This commit is contained in:
@@ -3,7 +3,6 @@ import http from 'node:http';
|
||||
import test from 'node:test';
|
||||
|
||||
import {
|
||||
createLatestRequest,
|
||||
createOperationRegistry,
|
||||
OPERATION_CONFLICTS,
|
||||
operationBlocked,
|
||||
@@ -72,22 +71,3 @@ test('a conflicting operation is rejected before its action starts', async () =>
|
||||
connection.resolve(true);
|
||||
await running;
|
||||
});
|
||||
|
||||
test('latest request cancels and ignores a stale validation result', async () => {
|
||||
const latest = createLatestRequest();
|
||||
const oldResult = deferred();
|
||||
const newResult = deferred();
|
||||
let oldSignal;
|
||||
|
||||
const oldRequest = latest.run((signal) => {
|
||||
oldSignal = signal;
|
||||
return oldResult.promise;
|
||||
});
|
||||
const newRequest = latest.run(() => newResult.promise);
|
||||
oldResult.resolve('old');
|
||||
newResult.resolve('new');
|
||||
|
||||
assert.equal(await oldRequest, undefined);
|
||||
assert.equal(await newRequest, 'new');
|
||||
assert.equal(oldSignal.aborted, true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user