@vicary/alpaca-sdk
Version:
A TypeScript SDK for the https://alpaca.markets REST API and WebSocket streams.
12 lines (11 loc) • 346 B
JavaScript
// Used to mock the fetch function in tests
export const mockFetch = (response) => (_url, _init) =>
// Return a promise that resolves with a response
Promise.resolve(new Response(typeof response === "object"
? JSON.stringify(response)
: response, {
status: 200,
headers: {
"Content-Type": "application/json",
},
}));