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