Answers for "check return type jest"

0

check return type jest

expect(result instanceof Date).toBe(true)

// Another example to match primitive types:
expect(typeof target).toBe("boolean")
expect(typeof target).toBe("number")
expect(typeof target).toBe("string")
expect(typeof target).toBe('function')

expect(Array.isArray(target)).toBe(true)
expect(target && typeof target === 'object').toBe(true)

expect(target === null).toBe('null')
expect(target === undefined).toBe('undefined')

expect(!!target && typeof target.then === 'function').toBe(true)
Posted by: Guest on February-21-2022

Code answers related to "TypeScript"

Browse Popular Code Answers by Language