It seems that the coverage is not correct with the function that I'd like to test :
public isSelfTweet = function(tweet: Tweet, twitterScreenName: string) {
if(null == tweet || null == tweet.user || null == tweet.user.screen_name) {
return false;
}
if(tweet.user.screen_name.toLowerCase() === twitterScreenName) {
return true;
}
return false;
}
I write three tests and I have a 100% coverage :
- tweet = null, twitterScreenName = "toto"
- tweet with screen_name = "toto", twitterScreenName = "toto"
- tweet with screen_name = "toto", twitterScreenName = "tutu"
Here is the coverage which seems incorrect for me. I never have tested tweet not null, but tweet.user null for instance
In my package json :
"nyc": "^11.2.1",
Aucun commentaire:
Enregistrer un commentaire