mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 08:16:50 +08:00
Add an algorithm to find Taylor series approximation of exponential f… (#1160)
This commit is contained in:

committed by
GitHub

parent
58671861a5
commit
73bf91d7e1
16
Maths/test/ExponentialFunction.test.js
Normal file
16
Maths/test/ExponentialFunction.test.js
Normal file
@ -0,0 +1,16 @@
|
||||
import { exponentialFunction } from '../ExponentialFunction'
|
||||
|
||||
describe('Tests for exponential function', () => {
|
||||
it('should be a function', () => {
|
||||
expect(typeof exponentialFunction).toEqual('function')
|
||||
})
|
||||
|
||||
it('should throw error for invalid input', () => {
|
||||
expect(() => exponentialFunction(2, -34)).toThrow()
|
||||
})
|
||||
|
||||
it('should return the exponential function of power of 5 and order of 21', () => {
|
||||
const ex = exponentialFunction(5, 20)
|
||||
expect(ex).toBe(148.4131078683383)
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user