javascript – Jasmine spyon a function not in an object


Am trying to write tests and I want to spy on this library function which is exported as default. So anyhow I import the library, it just returns the function hence unable to call e.g. spyOn(flatpickr, 'default'). The imports:

import * as flatpickr from 'flatpickr';  // typeof flatpickr === 'function'
import fp, * as an from 'flatpickr'; // typeof fp === 'function' &&  // typeof an === 'function'
import { default as def } from 'flatpickr'; // typeof def === 'function'
const fpReq = require('flatpickr'); // typeof fpReq === 'function'

I have no other way of approaching this and I have already wasted enough time on this. Any help would be highly appreciated.

P.S. All these other suggestions I got from the internet, all other suggestions have not proven effective.