См. Пример кода ниже. Как мне 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')
})
})