I don't know if I am stupid, but, I have installed web-request module:
npm install web-request
it is installed, it is present in node modules. I try to use it:
import * as WebRequest from 'web-request';
export class MyHttp {
public static getUrl() {
console.log('hello');
WebRequest.get('http://www.google.com/').then(()=> {
console.log('success');
});
}
}
Then I use it in the test:
import {MyHttp} from '../../../services/MyHttp';
describe('Request', () => {
fit('should be successful', () => {
MyHttp.getUrl();
setTimeout(()=> {
expect(true).toBe(true);
},5000);
});
});
The console output is:
hello
I cannot see 'success' output at all.
The typings is ok, I am able to enter web-request\index.d.ts, that looks fine.
What am I doing wrong ? :(
catcherror handler to the promise?