1import getDevServer from '../../getDevServer'; 2import { buildUrlForBundle } from '../buildUrlForBundle'; 3 4export const asMock = <T extends (...args: any[]) => any>(fn: T): jest.MockedFunction<T> => 5 fn as jest.MockedFunction<T>; 6 7jest.mock('../../getDevServer', () => ({ 8 __esModule: true, 9 default: jest.fn(), 10})); 11 12it(`returns an expected URL`, () => { 13 asMock(getDevServer).mockReturnValueOnce({ 14 bundleLoadedFromServer: true, 15 fullBundleUrl: 16 'http://localhost:19000?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null', 17 url: 'http://localhost:19000', 18 }); 19 20 expect(buildUrlForBundle('/foobar')).toEqual('http://localhost:19000/foobar'); 21}); 22