Common front-end components for Web using the Tesseract design system, written for React. https://make.modal.sh/tesseract/web/react/common
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 

43 satır
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(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. })