bruderstein / unexpected-react

Plugin for http://unexpected.js.org to enable testing the full React virtual DOM, and also the shallow renderer
http://bruderstein.github.io/unexpected-react
MIT License
186 stars 19 forks source link

When updating from v3.2.4 to v3.3.0/v3.3.1 asserting on objects with no prototype fails #31

Closed eigenmannmartin closed 7 years ago

eigenmannmartin commented 7 years ago

This case does occurs with deeply nested Objects when there is no proto defined.

describe('should not use props hasOwnProperty', () => {
    it('should assert a nested array', () => {
        var result = {
            id: '666',
            name: 'Chuck Norris'
        };
        result.__proto__ = null;

        return expect(result, 'to satisfy', {
            attributes: {
                id: '666',
                name: 'Chuck Norris'
            }
        });
    });
});

I did some debugging but was unable to figure out where it comes from. Let me know it I can help in some way.

cheers Martin

bruderstein commented 7 years ago

Sorry, yes, you're right. Apologies. Thanks for reporting.

The issue is here: https://github.com/bruderstein/unexpected-react/blob/master/src/types.js#L119

I'll fix it later today and publish a new version. I'll also add a test so this can't happen again.

eigenmannmartin commented 7 years ago

@bruderstein Thanks very much! btw. awesome work :heart: