提交 ef247cfa 编写于 作者: S Sandeep Somavarapu

fix tests

上级 6e3245c7
...@@ -333,38 +333,40 @@ suite('UserDataSyncRequestsSession', () => { ...@@ -333,38 +333,40 @@ suite('UserDataSyncRequestsSession', () => {
}; };
test('too many requests are thrown when limit exceeded', async () => { test('too many requests are thrown when limit exceeded', async () => {
const testObject = new RequestsSession(1, 100, requestService, NullTelemetryService); const testObject = new RequestsSession(1, 500, requestService, NullTelemetryService);
await testObject.request({}, CancellationToken.None); await testObject.request({}, CancellationToken.None);
try { try {
await testObject.request({}, CancellationToken.None); await testObject.request({}, CancellationToken.None);
assert.fail('Should fail with limit exceeded');
} catch (error) { } catch (error) {
assert.ok(error instanceof UserDataSyncStoreError); assert.ok(error instanceof UserDataSyncStoreError);
assert.equal((<UserDataSyncStoreError>error).code, UserDataSyncErrorCode.LocalTooManyRequests); assert.equal((<UserDataSyncStoreError>error).code, UserDataSyncErrorCode.LocalTooManyRequests);
return;
} }
assert.fail('Should fail with limit exceeded');
}); });
test('requests are handled after session is expired', async () => { test('requests are handled after session is expired', async () => {
const testObject = new RequestsSession(1, 100, requestService, NullTelemetryService); const testObject = new RequestsSession(1, 500, requestService, NullTelemetryService);
await testObject.request({}, CancellationToken.None); await testObject.request({}, CancellationToken.None);
await timeout(150); await timeout(600);
await testObject.request({}, CancellationToken.None); await testObject.request({}, CancellationToken.None);
}); });
test('too many requests are thrown after session is expired', async () => { test('too many requests are thrown after session is expired', async () => {
const testObject = new RequestsSession(1, 100, requestService, NullTelemetryService); const testObject = new RequestsSession(1, 500, requestService, NullTelemetryService);
await testObject.request({}, CancellationToken.None); await testObject.request({}, CancellationToken.None);
await timeout(150); await timeout(600);
await testObject.request({}, CancellationToken.None); await testObject.request({}, CancellationToken.None);
try { try {
await testObject.request({}, CancellationToken.None); await testObject.request({}, CancellationToken.None);
assert.fail('Should fail with limit exceeded');
} catch (error) { } catch (error) {
assert.ok(error instanceof UserDataSyncStoreError); assert.ok(error instanceof UserDataSyncStoreError);
assert.equal((<UserDataSyncStoreError>error).code, UserDataSyncErrorCode.LocalTooManyRequests); assert.equal((<UserDataSyncStoreError>error).code, UserDataSyncErrorCode.LocalTooManyRequests);
return;
} }
assert.fail('Should fail with limit exceeded');
}); });
}); });
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册