I have a function in ionic 2 service which I would like to test.
service.ts
upload(){
let file = new Transfer();
file.upload(myfile).then( // my callback );
}
I would like to mock Transfer
in my test using jasmine
. I tried this in my
sevice.spec.ts
import { TransferMock as Transfer } from '../mocks/mocks'
to mock it. But it is not working. This is how my test is instantiated .
describe('authentication service' , () => {
beforeEach(() => {
auth = new Service(<any>new HttpMock(), <any>new StorageMock())
});
it('initialize authentication',() => {
expect(auth).not.toEqual(null);
});
})
Transfer
is not injected in the service.