请参见下面的示例代码。我该如何spyOn
notExportedFunction
调用exportedFunction
?
// some-module.ts
const notExportedFunction = (arg1: SomeType, arg2: SomeType) => 42
const export exportedFunction = (arg1: SomeType, arg2: SomeType): SomeOtherType => {
const intermediateCalculation = notExportedFunction(arg1, arg2)
// ...
return whatever
}
// some-spec.ts
import { exportedFunction } from './some-module.ts'
describe('exportedFunction', () => {
it('works', () => {
spyOn(WHAT_DO_I_PUT_HERE, 'notExportedFunction').and.returnValue({})
exportedFunction('foo', 'bar')
})
})