Skip to content

Commit

Permalink
fixed test cases Limit.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
MarufHasan24 authored Oct 4, 2023
1 parent 3e29f29 commit 03a44ef
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Maths/test/Limit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,27 @@ describe("limit", () => {
expect(limit(1, Math.sin)).toBeCloseTo(0.84147);
});
it("should return 0", () => {
expect(limit(Infinity, (x) => Math.sin(x) / x)).toBe(0);
expect(limit(0, (x) => Math.sin(x) / x)).toBe(1);
});
it("should return 1", () => {
expect(limit(Infinity, (x) => Math.cos(x) / x)).toBe(1);
expect(limit(0, (x) => Math.cos(x) / x)).toBe(0);
});
it("should throw error", () => {
expect(() => limit("10", (x) => Math.cos(x) / x)).toThrow(TypeError);
expect(limit("10", (x) => Math.cos(x) / x)).toThrow(TypeError);
});
it("should throw error", () => {
expect(() => limit(10, "x")).toThrow(SyntaxError);
expect(limit(10, "x")).toThrow(SyntaxError);
});
it("should throw error", () => {
expect(() => limit(10, (x) => Math.cos(x) / x, 12)).toThrow(TypeError);
expect(limit(10, (x) => Math.cos(x) / x, 12)).toThrow(TypeError);
});
it("should throw error", () => {
expect(() => limit(10, (x) => Math.cos(x) / x, 0)).toThrow(TypeError);
expect(limit(10, (x) => Math.cos(x) / x, 0)).toThrow(TypeError);
});
it("should throw error", () => {
expect(() =>
expect(
limit(10, (x) => {
console.log(x);
return "abc";
})
).toThrow(TypeError);
Expand Down

0 comments on commit 03a44ef

Please sign in to comment.