import { WindowRef } from '../app/services/window.service';


let winRef: WindowRef;

if (!window) {
    let window = {
        open(){}
    };
}


describe('Window service tests', () => {

    beforeEach(() => {
        winRef = new WindowRef();
    });

    it('should use http protocol', () => {
        const path = 'user.com';
        spyOn(winRef, 'navigateToUrl').and.callThrough();
        spyOn(window, 'open').and.callThrough();
        winRef.openExternalHttpTab(path);
        expect(winRef.navigateToUrl).toHaveBeenCalledWith('http', path, true);
        expect(window.open).toHaveBeenCalledWith(`http://${path}`, '_blank');
    });
});
