react-use-countdown/test/sample.test.js

26 lines
687 B
JavaScript
Raw Normal View History

2020-08-28 15:36:20 +07:00
import {power} from "../src"
2020-08-28 15:15:51 +07:00
// Describe : top level to describe a block of test below is for what
describe("Test Sample Function", () => {
// Test : is run for each test
test("Test N is Undefined", () => {
2020-08-28 15:36:20 +07:00
expect(power(undefined)).toBe(undefined) // expect sample(undefined) return undefined
2020-08-28 15:15:51 +07:00
})
test("Test N is Null", () => {
2020-08-28 15:36:20 +07:00
expect(power(null)).toBe(undefined)
2020-08-28 15:15:51 +07:00
})
test("Test N is not number",() => {
2020-08-28 15:36:20 +07:00
expect(power("Hello")).toBe(undefined)
2020-08-28 15:15:51 +07:00
})
test("Test Normal Number",() => {
2020-08-28 15:36:20 +07:00
expect(power(0)).toBe(0)
expect(power(1)).toBe(1)
expect(power(2)).toBe(4)
expect(power(100)).toBe(10000)
2020-08-28 15:15:51 +07:00
})
})