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

Fixed test cases for 3-promise-all and 4-promise-chain #361

Closed
wants to merge 2 commits into from
Closed
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
8 changes: 4 additions & 4 deletions week-2/01-async-js/tests/3-promise-all.test.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
const calculateTime = require("../hard (promises)/3-promise-all");

describe("calculateTime function", () => {
test("calculates time 1", async () => {
test.concurrent("calculates time 1", async () => {
const difference = await calculateTime(1, 2, 3);
expect(difference).toBeGreaterThanOrEqual(3000);
expect(difference).toBeLessThan(4000);
}, 4000);

test("calculates time 2", async () => {
test.concurrent("calculates time 2", async () => {
const difference = await calculateTime(4, 5, 7);
expect(difference).toBeGreaterThanOrEqual(7000);
expect(difference).toBeLessThan(8000);
}, 8000);

test("calculates time 3", async () => {
test.concurrent("calculates time 3", async () => {
const difference = await calculateTime(10, 1, 1);
expect(difference).toBeGreaterThanOrEqual(10000);
expect(difference).toBeLessThan(11000);
}, 11000);

test("calculates time for zero seconds", async () => {
test.concurrent("calculates time for zero seconds", async () => {
const difference = await calculateTime(0, 0, 0);
expect(difference).toBeGreaterThanOrEqual(0);
expect(difference).toBeLessThan(1000);
Expand Down
6 changes: 3 additions & 3 deletions week-2/01-async-js/tests/4-promise-chain.test.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
const calculateTime = require("../hard (promises)/4-promise-chain");

describe("calculateTime function", () => {
test("calculates time 1", async () => {
test.concurrent("calculates time 1", async () => {
const difference = await calculateTime(1, 2, 3);
expect(difference).toBeGreaterThanOrEqual(6000);
expect(difference).toBeLessThan(7000);
}, 7000);

test("calculates time 2", async () => {
test.concurrent("calculates time 2", async () => {
const difference = await calculateTime(10, 1, 1);
expect(difference).toBeGreaterThanOrEqual(12000);
expect(difference).toBeLessThan(13000);
}, 14000);

test("calculates time for zero seconds", async () => {
test.concurrent("calculates time for zero seconds", async () => {
const difference = await calculateTime(0, 0, 0);
expect(difference).toBeGreaterThanOrEqual(0);
expect(difference).toBeLessThan(100);
Expand Down