Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Commit

Permalink
removed some duplicate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mweststrate committed Nov 9, 2016
1 parent 1c08739 commit 7243a9d
Showing 1 changed file with 0 additions and 70 deletions.
70 changes: 0 additions & 70 deletions test/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,76 +176,6 @@ test('observer based context', t => {
t.end();
})

test('warning is printed when attaching propTypes/defaultProps/contextTypes to HOC not in production', t => {
var msg = [];
var baseWarn = console.warn;
console.warn = (m) => msg.push(m);

var C = inject(["foo"])(React.createClass({
displayName: 'C',
render: function() {
return e("div", {}, "context:" + this.props.foo);
}
}));

C.propTypes = {};
C.defaultProps = {};
C.contextTypes = {};

var B = React.createClass({
render: function() {
return e(C, {});
}
});

var A = React.createClass({
render: function() {
return e(Provider, { foo: "bar" }, e(B, {}))
}
})

const wrapper = mount(e(A));
t.equal(msg.length, 3);
t.equal(msg[0], "Mobx Injector: you are trying to attach propTypes to HOC instead of C. Use `wrappedComponent` property.");
t.equal(msg[1], "Mobx Injector: you are trying to attach defaultProps to HOC instead of C. Use `wrappedComponent` property.");
t.equal(msg[2], "Mobx Injector: you are trying to attach contextTypes to HOC instead of C. Use `wrappedComponent` property.");

console.warn = baseWarn;
t.end();
})


test('warning is not printed when attaching propTypes to wrappedComponent', t => {
var msg = [];
var baseWarn = console.warn;
console.warn = (m) => msg = m;

var C = inject(["foo"])(React.createClass({
displayName: 'C',
render: function() {
return e("div", {}, "context:" + this.props.foo);
}
}));

C.wrappedComponent.propTypes = {};

var B = React.createClass({
render: function() {
return e(C, {});
}
});

var A = React.createClass({
render: function() {
return e(Provider, { foo: "bar" }, e(B, {}))
}
})

const wrapper = mount(e(A));
t.equal(msg.length, 0);
console.warn = baseWarn;
t.end();
})


t.end()
Expand Down

0 comments on commit 7243a9d

Please sign in to comment.