Skip to content

fix(javascript): utils tests run time #908

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

Merged
merged 1 commit into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('createIterablePromise', () => {
await expect(promise).resolves.toEqual('success #2');

expect(Date.now() - before).toBeGreaterThanOrEqual(0);
expect(Date.now() - before).toBeLessThan(10);
expect(Date.now() - before).toBeLessThanOrEqual(10);
expect(calls).toBe(2);
});

Expand All @@ -133,7 +133,7 @@ describe('createIterablePromise', () => {
await expect(promise).resolves.toEqual('success #2');

expect(Date.now() - before).toBeGreaterThanOrEqual(2000);
expect(Date.now() - before).toBeLessThan(2010);
expect(Date.now() - before).toBeLessThanOrEqual(2010);
expect(calls).toBe(2);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ describe('timeout handling', () => {
const now = Date.now();

expect(response.content).toBe('Connection timeout');
expect(now - before).toBeGreaterThan(999);
expect(now - before).toBeLessThan(1200);
expect(now - before).toBeGreaterThanOrEqual(999);
expect(now - before).toBeLessThanOrEqual(1200);
});

it('connection timeouts with the given 2 seconds connection timeout', async () => {
Expand All @@ -137,8 +137,8 @@ describe('timeout handling', () => {
const now = Date.now();

expect(response.content).toBe('Connection timeout');
expect(now - before).toBeGreaterThan(1990);
expect(now - before).toBeLessThan(2200);
expect(now - before).toBeGreaterThanOrEqual(1990);
expect(now - before).toBeLessThanOrEqual(2200);
});

it("socket timeouts if response don't appears before the timeout with 2 seconds timeout", async () => {
Expand All @@ -153,8 +153,8 @@ describe('timeout handling', () => {
const now = Date.now();

expect(response.content).toBe('Socket timeout');
expect(now - before).toBeGreaterThan(1990);
expect(now - before).toBeLessThan(2200);
expect(now - before).toBeGreaterThanOrEqual(1990);
expect(now - before).toBeLessThanOrEqual(2200);
});

it("socket timeouts if response don't appears before the timeout with 3 seconds timeout", async () => {
Expand All @@ -169,8 +169,8 @@ describe('timeout handling', () => {
const now = Date.now();

expect(response.content).toBe('Socket timeout');
expect(now - before).toBeGreaterThan(2999);
expect(now - before).toBeLessThan(3200);
expect(now - before).toBeGreaterThanOrEqual(2999);
expect(now - before).toBeLessThanOrEqual(3200);
});

it('do not timeouts if response appears before the timeout', async () => {
Expand All @@ -186,8 +186,8 @@ describe('timeout handling', () => {
expect(response.isTimedOut).toBe(false);
expect(response.status).toBe(200);
expect(response.content).toBe('{"foo": "bar"}');
expect(now - before).toBeGreaterThan(4999);
expect(now - before).toBeLessThan(5200);
expect(now - before).toBeGreaterThanOrEqual(4999);
expect(now - before).toBeLessThanOrEqual(5200);
}, 10000); // This is a long-running test, default server timeout is set to 5000ms
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ describe('timeout handling', () => {
const now = Date.now();

expect(response.content).toBe('Connection timeout');
expect(now - before).toBeGreaterThan(999);
expect(now - before).toBeLessThan(1200);
expect(now - before).toBeGreaterThanOrEqual(999);
expect(now - before).toBeLessThanOrEqual(1200);
});

it('connection timeouts with the given 2 seconds connection timeout', async () => {
Expand All @@ -151,8 +151,8 @@ describe('timeout handling', () => {
const now = Date.now();

expect(response.content).toBe('Connection timeout');
expect(now - before).toBeGreaterThan(1999);
expect(now - before).toBeLessThan(2200);
expect(now - before).toBeGreaterThanOrEqual(1999);
expect(now - before).toBeLessThanOrEqual(2200);
});

it("socket timeouts if response don't appears before the timeout with 2 seconds timeout", async () => {
Expand All @@ -167,8 +167,8 @@ describe('timeout handling', () => {
const now = Date.now();

expect(response.content).toBe('Socket timeout');
expect(now - before).toBeGreaterThan(1999);
expect(now - before).toBeLessThan(2200);
expect(now - before).toBeGreaterThanOrEqual(1999);
expect(now - before).toBeLessThanOrEqual(2200);
});

it("socket timeouts if response don't appears before the timeout with 3 seconds timeout", async () => {
Expand All @@ -182,8 +182,8 @@ describe('timeout handling', () => {
const now = Date.now();

expect(response.content).toBe('Socket timeout');
expect(now - before).toBeGreaterThan(2999);
expect(now - before).toBeLessThan(3200);
expect(now - before).toBeGreaterThanOrEqual(2999);
expect(now - before).toBeLessThanOrEqual(3200);
});

it('do not timeouts if response appears before the timeout', async () => {
Expand All @@ -199,8 +199,8 @@ describe('timeout handling', () => {
expect(response.isTimedOut).toBe(false);
expect(response.status).toBe(200);
expect(response.content).toBe('{"foo": "bar"}');
expect(now - before).toBeGreaterThan(4999);
expect(now - before).toBeLessThan(5200);
expect(now - before).toBeGreaterThanOrEqual(4999);
expect(now - before).toBeLessThanOrEqual(5200);
}, 10000); // This is a long-running test, default server timeout is set to 5000ms
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ describe('timeout handling', () => {
const now = Date.now();

expect(response.content).toBe('Connection timeout');
expect(now - before).toBeGreaterThan(999);
expect(now - before).toBeLessThan(1200);
expect(now - before).toBeGreaterThanOrEqual(999);
expect(now - before).toBeLessThanOrEqual(1200);
});

it('connection timeouts with the given 2 seconds connection timeout', async () => {
Expand All @@ -207,8 +207,8 @@ describe('timeout handling', () => {
const now = Date.now();

expect(response.content).toBe('Connection timeout');
expect(now - before).toBeGreaterThan(1999);
expect(now - before).toBeLessThan(2200);
expect(now - before).toBeGreaterThanOrEqual(1999);
expect(now - before).toBeLessThanOrEqual(2200);
});

it("socket timeouts if response don't appears before the timeout with 2 seconds timeout", async () => {
Expand All @@ -223,8 +223,8 @@ describe('timeout handling', () => {
const now = Date.now();

expect(response.content).toBe('Socket timeout');
expect(now - before).toBeGreaterThan(1999);
expect(now - before).toBeLessThan(2200);
expect(now - before).toBeGreaterThanOrEqual(1999);
expect(now - before).toBeLessThanOrEqual(2200);
});

it("socket timeouts if response don't appears before the timeout with 3 seconds timeout", async () => {
Expand All @@ -238,8 +238,8 @@ describe('timeout handling', () => {
const now = Date.now();

expect(response.content).toBe('Socket timeout');
expect(now - before).toBeGreaterThan(2999);
expect(now - before).toBeLessThan(3200);
expect(now - before).toBeGreaterThanOrEqual(2999);
expect(now - before).toBeLessThanOrEqual(3200);
});

it('do not timeouts if response appears before the timeout', async () => {
Expand All @@ -255,8 +255,8 @@ describe('timeout handling', () => {
expect(response.isTimedOut).toBe(false);
expect(response.status).toBe(200);
expect(response.content).toBe('{"foo": "bar"}');
expect(now - before).toBeGreaterThan(4999);
expect(now - before).toBeLessThan(5200);
expect(now - before).toBeGreaterThanOrEqual(4999);
expect(now - before).toBeLessThanOrEqual(5200);
}, 10000); // This is a long-running test, default server timeout is set to 5000ms
});

Expand Down