Ternary Operator Testing With Ava or Sinon

105 views Asked by At

I have a variable like this:

const domain_issuer = "some array of domains"
const url_setter = domain_issuer !== null ? domain_issuer[0] : '';

the domain_issuer is grabbing the domains from a config file that has arrays of different domains and it uses a regex to match a specific domain. So the url_setter checks to see if domain_issuer is null or not null and if it is null it assigns it to an empty string, if not, the first match gets assigned to url_setter

My branch coverage says the '' (empty string) is not covered. I tried different things to reach that statement but nothing seems to work.

How can I cover this?

0

There are 0 answers