Comparing version 0.3.3 to 0.4.0
@@ -1,4 +0,4 @@ | ||
export { A as AwaitedMockValue, H as HeadersMockInit, M as Method, i as MockValue, j as Mocks, f as createMockApi, m as mockApi, a as mockDelete, b as mockGet, c as mockPatch, d as mockPost, e as mockPut, p as prepareFetch } from './api-2aa24142'; | ||
export { A as AwaitedMockValue, H as HeadersMockInit, M as Method, i as MockValue, j as Mocks, f as createMockFetch, a as mockDelete, m as mockFetch, b as mockGet, c as mockPatch, d as mockPost, e as mockPut, p as prepareFetch } from './api-3d48acc0'; | ||
import 'tinyspy'; | ||
import './headers'; | ||
import './response'; |
@@ -6,5 +6,5 @@ import { | ||
import { spyOn } from "tinyspy"; | ||
import { HeadersMock } from "./headers"; | ||
import { FetchMockInstance } from "./mock"; | ||
import { ResponseMock } from "./response"; | ||
import { HeadersMock } from "./headers.js"; | ||
import { FetchMockInstance } from "./mock.js"; | ||
import { ResponseMock } from "./response.js"; | ||
const methods = ["GET", "POST", "PATCH", "PUT", "DELETE"]; | ||
@@ -135,6 +135,6 @@ class MockStorage { | ||
}; | ||
const mockApi = spyOnFetch.bind(spyOnFetch); | ||
mockApi.clearAll = spyOnFetch.clearAll; | ||
mockApi.options = spyOnFetch.options; | ||
mockApi.setOptions = spyOnFetch.setOptions; | ||
const mockFetch = spyOnFetch.bind(spyOnFetch); | ||
mockFetch.clearAll = spyOnFetch.clearAll; | ||
mockFetch.options = spyOnFetch.options; | ||
mockFetch.setOptions = spyOnFetch.setOptions; | ||
const createAlias = (method) => spyOnFetch.bind(spyOnFetch, method); | ||
@@ -146,3 +146,3 @@ const mockGet = createAlias("GET"); | ||
const mockPut = createAlias("PUT"); | ||
function createMockApi({ | ||
function createMockFetch({ | ||
baseUrl = "", | ||
@@ -153,8 +153,8 @@ global = settings.global, | ||
const options = { baseUrl, global, fetchKey }; | ||
const mockApi2 = spyOnFetch.bind({ options }); | ||
mockApi2.options = options; | ||
mockApi2.clearAll = spyOnFetch.clearAll; | ||
mockApi2.setOptions = (opts) => { | ||
const mockFetch2 = spyOnFetch.bind({ options }); | ||
mockFetch2.options = options; | ||
mockFetch2.clearAll = spyOnFetch.clearAll; | ||
mockFetch2.setOptions = (opts) => { | ||
if (typeof options.baseUrl === "string") { | ||
mockApi2.options.baseUrl = options.baseUrl; | ||
mockFetch2.options.baseUrl = options.baseUrl; | ||
} | ||
@@ -164,8 +164,8 @@ setGlobals(opts); | ||
return { | ||
mockApi: mockApi2, | ||
mockGet: mockApi2.bind(mockApi2, "GET"), | ||
mockPost: mockApi2.bind(mockApi2, "POST"), | ||
mockPatch: mockApi2.bind(mockApi2, "PATCH"), | ||
mockDelete: mockApi2.bind(mockApi2, "DELETE"), | ||
mockPut: mockApi2.bind(mockApi2, "PUT") | ||
mockFetch: mockFetch2, | ||
mockGet: mockFetch2.bind(mockFetch2, "GET"), | ||
mockPost: mockFetch2.bind(mockFetch2, "POST"), | ||
mockPatch: mockFetch2.bind(mockFetch2, "PATCH"), | ||
mockDelete: mockFetch2.bind(mockFetch2, "DELETE"), | ||
mockPut: mockFetch2.bind(mockFetch2, "PUT") | ||
}; | ||
@@ -175,5 +175,5 @@ } | ||
Mocks, | ||
createMockApi, | ||
mockApi, | ||
createMockFetch, | ||
mockDelete, | ||
mockFetch, | ||
mockGet, | ||
@@ -180,0 +180,0 @@ mockPatch, |
@@ -9,3 +9,3 @@ import "./chunk-JUWXSDKJ.js"; | ||
toFetchNthTimeWithQuery | ||
} from "./matchers"; | ||
} from "./matchers.js"; | ||
function declareFetchAssertions(expect2) { | ||
@@ -12,0 +12,0 @@ expect2.extend({ |
@@ -0,0 +0,0 @@ declare class HeadersMock implements Headers { |
export { declareFetchAssertions } from './extend'; | ||
export { f as createMockApi, m as mockApi, a as mockDelete, b as mockGet, c as mockPatch, d as mockPost, e as mockPut, p as prepareFetch } from './api-2aa24142'; | ||
export { f as createMockApi, a as mockDelete, m as mockFetch, b as mockGet, c as mockPatch, d as mockPost, e as mockPut, p as prepareFetch } from './api-3d48acc0'; | ||
import 'tinyspy'; | ||
import './headers'; | ||
import './response'; |
import "./chunk-JUWXSDKJ.js"; | ||
import { declareFetchAssertions } from "./extend"; | ||
import { declareFetchAssertions } from "./extend.js"; | ||
import { | ||
prepareFetch, | ||
mockApi, | ||
mockFetch, | ||
mockDelete, | ||
@@ -11,9 +11,9 @@ mockGet, | ||
mockPut, | ||
createMockApi | ||
} from "./api"; | ||
createMockFetch | ||
} from "./api.js"; | ||
export { | ||
createMockApi, | ||
createMockFetch as createMockApi, | ||
declareFetchAssertions, | ||
mockApi, | ||
mockDelete, | ||
mockFetch, | ||
mockGet, | ||
@@ -20,0 +20,0 @@ mockPatch, |
@@ -1,2 +0,2 @@ | ||
import { F as FetchSpyInstance } from './api-2aa24142'; | ||
import { F as FetchSpyInstance } from './api-3d48acc0'; | ||
import 'tinyspy'; | ||
@@ -3,0 +3,0 @@ import './headers'; |
import 'tinyspy'; | ||
export { g as FetchArgs, h as FetchMockInstance, F as FetchSpyInstance } from './api-2aa24142'; | ||
export { g as FetchArgs, h as FetchMockInstance, F as FetchSpyInstance } from './api-3d48acc0'; | ||
import './headers'; | ||
import './response'; |
import "./chunk-JUWXSDKJ.js"; | ||
import { Mocks } from "./api"; | ||
import { HeadersMock } from "./headers"; | ||
import { getStatusText } from "./statuses"; | ||
import { guessContentType } from "./utils"; | ||
import { Mocks } from "./api.js"; | ||
import { HeadersMock } from "./headers.js"; | ||
import { getStatusText } from "./statuses.js"; | ||
import { guessContentType } from "./utils.js"; | ||
const getError = (err) => { | ||
@@ -7,0 +7,0 @@ if (typeof err === "string") { |
@@ -0,0 +0,0 @@ import { HeadersMock } from './headers'; |
import "./chunk-JUWXSDKJ.js"; | ||
import { HeadersMock } from "./headers"; | ||
import { HeadersMock } from "./headers.js"; | ||
class ResponseMock { | ||
@@ -4,0 +4,0 @@ constructor(path, value, init) { |
@@ -1,3 +0,3 @@ | ||
import "./extend"; | ||
import { prepareFetch } from "./api"; | ||
import "./extend.js"; | ||
import { prepareFetch } from "./api.js"; | ||
if (globalThis && globalThis.window && "fetch" in globalThis.window && globalThis.window.fetch) { | ||
@@ -4,0 +4,0 @@ prepareFetch(globalThis.window); |
@@ -0,0 +0,0 @@ declare const statusTextMap: Record<number, string>; |
@@ -0,0 +0,0 @@ interface FetchAssertions<R> { |
{ | ||
"name": "vi-fetch", | ||
"version": "0.3.3", | ||
"version": "0.4.0", | ||
"description": "Easiest way to mock fetch", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -0,0 +0,0 @@ # vi-fetch |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36431