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.

123456789101112131415161718192021222324252627282930313233343536373839404142
  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(fc.anything(), (v) => {
  16. expect(typeof isEmpty(v)).toBe('boolean')
  17. }),
  18. )
  19. })
  20. describe('on arguments', () => {
  21. it('should return `true` on an argument with value of `undefined`', () => {
  22. expect(isEmpty(undefined)).toBe(true)
  23. })
  24. it('should return `true` on an argument with value of `null`', () => {
  25. expect(isEmpty(null)).toBe(true)
  26. })
  27. it('should return `false` on an argument with value that is neither `undefined` nor `null`', () => {
  28. fc.assert(
  29. fc.property(fc.anything().filter((v) => typeof v !== 'undefined' && v !== null), (v) => {
  30. expect(isEmpty(v)).toBe(false)
  31. }),
  32. )
  33. })
  34. })
  35. })