Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

29 строки
1.0 KiB

  1. 'use strict'
  2. var expect = require('chai').expect;
  3. var React = require('react');
  4. var PropTypes = require('react').PropTypes;
  5. var addIsDeprecated = require('./dist').addIsDeprecated;
  6. var deprecate = require('./dist').deprecate;
  7. describe('react-is-deprecated', () => {
  8. Object.freeze(PropTypes)
  9. it('should not mutate the React PropTypes API', () => {
  10. let initialObjectType = PropTypes.object
  11. const NewPropTypes = addIsDeprecated(PropTypes)
  12. expect(PropTypes.object.isDeprecated).to.equal(undefined)
  13. expect(PropTypes.object === initialObjectType).to.equal(true)
  14. })
  15. console.log('PropTypes before tests', PropTypes.object.isDeprecated);
  16. it('should export an `addIsDeprecated` function', () => {
  17. expect(addIsDeprecated).to.be.a('function')
  18. })
  19. it('should export an `deprecate` function', () => {
  20. expect(deprecate).to.be.a('function')
  21. })
  22. it('should add an isDeprecated method to the passed PropTypes.', () => {
  23. const NewPropTypes = addIsDeprecated(PropTypes)
  24. expect(NewPropTypes.object.isDeprecated).to.be.a('function')
  25. })
  26. })