I have a service API which up until recently used the whois library to get data. I use sinon to test the API:
const mockWhoisLookup = sinon.mock(whois);
mockWhoisLookup
.expects('lookup')
.once()
.withArgs('deals.dk')
.callsFake((domain, callback) => {
callback(undefined, whoisSampleResponse);
});
I've decided to use whois-json instead as it provides a 'cleaner' output. The issue is that when I now run the test it gives me an error output:
TypeError: Attempted to wrap undefined property lookup as function
61 | const mockWhoisLookup = sinon.mock(whois);
62 | mockWhoisLookup
> 63 | .expects('lookup')
64 | .once()
65 | .withArgs('deals.dk')
66 | .callsFake((domain, callback) => {
How do I solve this issue?