Common front-end components for Web using the Tesseract design system, written for React. https://make.modal.sh/tesseract/web/react/common
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

49 lines
1.1 KiB

  1. import * as fc from 'fast-check'
  2. import isEmpty from './isEmpty'
  3. describe('lib/services/isEmpty', () => {
  4. it('should exist', () => {
  5. expect(isEmpty).toBeDefined()
  6. })
  7. it('should be a function', () => {
  8. expect(isEmpty).toBeFunction()
  9. })
  10. it('should accept 1 argument', () => {
  11. expect(isEmpty).toHaveLength(1)
  12. })
  13. it('should return a boolean value', () => {
  14. fc.assert(
  15. fc.property(
  16. fc.anything(),
  17. v => {
  18. expect(typeof isEmpty(v)).toBe('boolean')
  19. }
  20. )
  21. )
  22. })
  23. describe('on arguments', () => {
  24. it('should return `true` on an argument with value of `undefined`', () => {
  25. expect(isEmpty(undefined)).toBe(true)
  26. })
  27. it('should return `true` on an argument with value of `null`', () => {
  28. expect(isEmpty(null)).toBe(true)
  29. })
  30. it('should return `false` on an argument with value that is neither `undefined` nor `null`', () => {
  31. fc.assert(
  32. fc.property(
  33. fc.anything().filter(v => typeof v !== 'undefined' && v !== null),
  34. v => {
  35. expect(isEmpty(v)).toBe(false)
  36. }
  37. )
  38. )
  39. })
  40. })
  41. })