jeudi 15 septembre 2016

Chai testing evaluated value - React app

Hi I am trying to test the return value of MessageCount (for React app):

<ChannelListItem 
  messageCount = {fakeMessages.filter(msg => {return msg.channelID ===   channl.name}).length}
 channel = {channl}
 key = '1'
 onClick = {handleChangeChannel}
/>

My test

it('should have MessageCount', () => {
        const MessageCnt = Component.find('messageCount');

        expect(MessageCnt).to.be.ok;
        expect(MessageCnt).to.equal(2);
    }); 

I get error that MessageCnt is an object. How can I test the evaluated value of MessageCnt (to equal 2)? Thanks

Aucun commentaire:

Enregistrer un commentaire