Created
August 30, 2021 04:05
Revisions
-
maatthc created this gist
Aug 30, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ import urlBuilder from './url' let location: Location describe('urlBuilder', () => { beforeEach(() => { location = window.location jest.spyOn(window, 'location', 'get').mockRestore() }) test('given path, should return valid url', () => { const mockedLocation = { ...location, protocol: 'https:', host: 'www.google.com.au' } jest.spyOn(window, 'location', 'get').mockReturnValue(mockedLocation) const expectedUrl = 'https://www.google.com.br/faq' const result = urlBuilder('/static/faq') expect(result).toBe(expectedUrl) }) })