UNPKG

react-native-cross-components

Version:
1 lines 1.31 kB
{"file":"/Users/thomas/Source/react-native-core/config/jest/globalFetch.ts","mappings":";AAAA,6BAA6B;AAE7B,oDAAoD;AACpD,aAAa;AACb,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAEzB,gDAAgD;AAChD,aAAa;AACb,KAAK,CAAC,mBAAmB,GAAG,CAAC,IAAI,EAAE,EAAE;IACnC,aAAa;IACb,KAAK,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAChC,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CACnE,CAAC;AACJ,CAAC,CAAC;AAEF,gDAAgD;AAChD,aAAa;AACb,KAAK,CAAC,mBAAmB,GAAG,CAAC,KAAK,EAAE,EAAE;IACpC,aAAa;IACb,KAAK,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5D,CAAC,CAAC","names":[],"sources":["/Users/thomas/Source/react-native-core/config/jest/globalFetch.ts"],"sourcesContent":["/// <reference types=\"jest\"/>\n\n// Mocking the global.fetch included in React Native\n// @ts-ignore\nglobal.fetch = jest.fn();\n\n// Helper to mock a success response (only once)\n// @ts-ignore\nfetch.mockResponseSuccess = (body) => {\n // @ts-ignore\n fetch.mockImplementationOnce(() =>\n Promise.resolve({ json: () => Promise.resolve(JSON.parse(body)) })\n );\n};\n\n// Helper to mock a failure response (only once)\n// @ts-ignore\nfetch.mockResponseFailure = (error) => {\n // @ts-ignore\n fetch.mockImplementationOnce(() => Promise.reject(error));\n};\n"],"version":3}