Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use fake timers #150356

Merged
merged 1 commit into from May 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -484,14 +484,14 @@ suite('UserDataSyncRequestsSession', () => {
assert.fail('Should fail with limit exceeded');
});

test('requests are handled after session is expired', async () => {
test('requests are handled after session is expired', () => runWithFakedTimers({ useFakeTimers: true }, async () => {
const testObject = new RequestsSession(1, 100, requestService, new NullLogService());
await testObject.request('url', {}, CancellationToken.None);
await timeout(125);
await testObject.request('url', {}, CancellationToken.None);
});
}));

test('too many requests are thrown after session is expired', async () => {
test('too many requests are thrown after session is expired', () => runWithFakedTimers({ useFakeTimers: true }, async () => {
const testObject = new RequestsSession(1, 100, requestService, new NullLogService());
await testObject.request('url', {}, CancellationToken.None);
await timeout(125);
Expand All @@ -505,6 +505,6 @@ suite('UserDataSyncRequestsSession', () => {
return;
}
assert.fail('Should fail with limit exceeded');
});
}));

});