Skip to content

Commit 03a44ef

Browse files
authored
fixed test cases Limit.test.js
1 parent 3e29f29 commit 03a44ef

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Maths/test/Limit.test.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,27 @@ describe("limit", () => {
1111
expect(limit(1, Math.sin)).toBeCloseTo(0.84147);
1212
});
1313
it("should return 0", () => {
14-
expect(limit(Infinity, (x) => Math.sin(x) / x)).toBe(0);
14+
expect(limit(0, (x) => Math.sin(x) / x)).toBe(1);
1515
});
1616
it("should return 1", () => {
17-
expect(limit(Infinity, (x) => Math.cos(x) / x)).toBe(1);
17+
expect(limit(0, (x) => Math.cos(x) / x)).toBe(0);
1818
});
1919
it("should throw error", () => {
20-
expect(() => limit("10", (x) => Math.cos(x) / x)).toThrow(TypeError);
20+
expect(limit("10", (x) => Math.cos(x) / x)).toThrow(TypeError);
2121
});
2222
it("should throw error", () => {
23-
expect(() => limit(10, "x")).toThrow(SyntaxError);
23+
expect(limit(10, "x")).toThrow(SyntaxError);
2424
});
2525
it("should throw error", () => {
26-
expect(() => limit(10, (x) => Math.cos(x) / x, 12)).toThrow(TypeError);
26+
expect(limit(10, (x) => Math.cos(x) / x, 12)).toThrow(TypeError);
2727
});
2828
it("should throw error", () => {
29-
expect(() => limit(10, (x) => Math.cos(x) / x, 0)).toThrow(TypeError);
29+
expect(limit(10, (x) => Math.cos(x) / x, 0)).toThrow(TypeError);
3030
});
3131
it("should throw error", () => {
32-
expect(() =>
32+
expect(
3333
limit(10, (x) => {
34+
console.log(x);
3435
return "abc";
3536
})
3637
).toThrow(TypeError);

0 commit comments

Comments
 (0)