Comparing version 0.7.2 to 0.8.0
@@ -1,5 +0,5 @@ | ||
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, k as mockHead, c as mockPatch, d as mockPost, e as mockPut, p as prepareFetch } from './api-bbe5d54c'; | ||
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, k as mockHead, c as mockPatch, d as mockPost, e as mockPut, p as prepareFetch } from './api-f2735cfd.js'; | ||
import 'tinyspy'; | ||
import './headers'; | ||
import './appeanable'; | ||
import './response'; | ||
import './headers.js'; | ||
import './appeanable.js'; | ||
import './response.js'; |
@@ -1,5 +0,1 @@ | ||
import { | ||
__spreadProps, | ||
__spreadValues | ||
} from "./chunk-JUWXSDKJ.js"; | ||
import { spyOn } from "tinyspy"; | ||
@@ -57,3 +53,3 @@ import { HeadersMock } from "./headers.js"; | ||
const predicate = ({ method, path }) => { | ||
return method !== fetchMethod && path !== fetchUrl; | ||
return method !== fetchMethod || path !== fetchUrl; | ||
}; | ||
@@ -85,9 +81,11 @@ this.storage = this.storage.filter(predicate); | ||
if (typeof result.value !== "function") { | ||
return __spreadValues(__spreadValues({}, defaults), result.value); | ||
return { ...defaults, ...result.value }; | ||
} | ||
const headers = result.value.headers; | ||
const data = await result.value(new URL(url), input, init); | ||
return __spreadValues(__spreadProps(__spreadValues({}, defaults), { | ||
headers | ||
}), data); | ||
return { | ||
...defaults, | ||
headers, | ||
...data | ||
}; | ||
} | ||
@@ -102,5 +100,5 @@ function prepareFetch(obj = globalThis, key = "fetch") { | ||
obj[key] = async (urlOrRequest, optionsOrNothing) => { | ||
const url = typeof urlOrRequest === "string" ? urlOrRequest : urlOrRequest.url; | ||
const url = typeof urlOrRequest === "string" ? urlOrRequest : "href" in urlOrRequest ? urlOrRequest.href : urlOrRequest.url; | ||
const options = typeof optionsOrNothing !== "undefined" ? optionsOrNothing : { method: "GET" }; | ||
const method = typeof urlOrRequest !== "string" ? urlOrRequest.method : options.method || "GET"; | ||
const method = typeof urlOrRequest !== "string" && !("href" in urlOrRequest) ? urlOrRequest.method : options.method || "GET"; | ||
let result = Mocks.getApiCall(method.toUpperCase(), url); | ||
@@ -107,0 +105,0 @@ if (result === void 0) { |
@@ -1,2 +0,1 @@ | ||
import "./chunk-JUWXSDKJ.js"; | ||
class Appeandable { | ||
@@ -3,0 +2,0 @@ _s = []; |
@@ -1,2 +0,1 @@ | ||
import "./chunk-JUWXSDKJ.js"; | ||
import { | ||
@@ -3,0 +2,0 @@ toFetch, |
@@ -1,2 +0,2 @@ | ||
import { Appeandable } from './appeanable'; | ||
import { Appeandable } from './appeanable.js'; | ||
@@ -3,0 +3,0 @@ declare class FormDataMock extends Appeandable implements FormData { |
@@ -1,2 +0,1 @@ | ||
import "./chunk-JUWXSDKJ.js"; | ||
import { Appeandable } from "./appeanable.js"; | ||
@@ -3,0 +2,0 @@ class FormDataMock extends Appeandable { |
@@ -1,2 +0,2 @@ | ||
import { Appeandable } from './appeanable'; | ||
import { Appeandable } from './appeanable.js'; | ||
@@ -3,0 +3,0 @@ declare class HeadersMock extends Appeandable implements Headers { |
@@ -1,2 +0,1 @@ | ||
import "./chunk-JUWXSDKJ.js"; | ||
import { Appeandable } from "./appeanable.js"; | ||
@@ -3,0 +2,0 @@ function normalizeName(name) { |
@@ -1,6 +0,6 @@ | ||
export { declareFetchAssertions } from './extend'; | ||
export { F as FetchSpyInstance, 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-bbe5d54c'; | ||
export { declareFetchAssertions } from './extend.js'; | ||
export { F as FetchSpyInstance, 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-f2735cfd.js'; | ||
import 'tinyspy'; | ||
import './headers'; | ||
import './appeanable'; | ||
import './response'; | ||
import './headers.js'; | ||
import './appeanable.js'; | ||
import './response.js'; |
@@ -1,2 +0,1 @@ | ||
import "./chunk-JUWXSDKJ.js"; | ||
import { declareFetchAssertions } from "./extend.js"; | ||
@@ -3,0 +2,0 @@ import { |
@@ -1,6 +0,6 @@ | ||
import { F as FetchSpyInstance } from './api-bbe5d54c'; | ||
import { F as FetchSpyInstance } from './api-f2735cfd.js'; | ||
import 'tinyspy'; | ||
import './headers'; | ||
import './appeanable'; | ||
import './response'; | ||
import './headers.js'; | ||
import './appeanable.js'; | ||
import './response.js'; | ||
@@ -7,0 +7,0 @@ interface JestUtils { |
@@ -1,2 +0,1 @@ | ||
import "./chunk-JUWXSDKJ.js"; | ||
import { parse as parseQuery } from "query-string"; | ||
@@ -176,3 +175,3 @@ const arrayBufferEquality = (a, b) => { | ||
return ([input]) => { | ||
const url = typeof input === "string" ? input : input.url; | ||
const url = typeof input === "string" ? input : "href" in input ? input.href : input.url; | ||
const uri = new URL(url); | ||
@@ -179,0 +178,0 @@ if (expectedQueryObj instanceof URLSearchParams) { |
import 'tinyspy'; | ||
export { g as FetchArgs, h as FetchMockInstance, F as FetchSpyInstance } from './api-bbe5d54c'; | ||
import './headers'; | ||
import './response'; | ||
import './appeanable'; | ||
export { g as FetchArgs, h as FetchMockInstance, F as FetchSpyInstance } from './api-f2735cfd.js'; | ||
import './headers.js'; | ||
import './response.js'; | ||
import './appeanable.js'; |
@@ -1,2 +0,1 @@ | ||
import "./chunk-JUWXSDKJ.js"; | ||
import { Mocks } from "./api.js"; | ||
@@ -110,3 +109,3 @@ import { HeadersMock } from "./headers.js"; | ||
return false; | ||
let url = typeof input === "string" ? input : input.url; | ||
let url = typeof input === "string" ? input : "href" in input ? input.href : input.url; | ||
if (!this.options.includeQuery) { | ||
@@ -113,0 +112,0 @@ [url] = url.split("?"); |
@@ -1,3 +0,3 @@ | ||
import { HeadersMock } from './headers'; | ||
import './appeanable'; | ||
import { HeadersMock } from './headers.js'; | ||
import './appeanable.js'; | ||
@@ -4,0 +4,0 @@ declare class ResponseMock implements Response { |
@@ -1,2 +0,1 @@ | ||
import "./chunk-JUWXSDKJ.js"; | ||
import { HeadersMock } from "./headers.js"; | ||
@@ -3,0 +2,0 @@ class ResponseMock { |
@@ -1,2 +0,1 @@ | ||
import "./chunk-JUWXSDKJ.js"; | ||
const statusTextMap = { | ||
@@ -3,0 +2,0 @@ 100: "Continue", |
@@ -1,2 +0,1 @@ | ||
import "./chunk-JUWXSDKJ.js"; | ||
function guessContentType(body) { | ||
@@ -3,0 +2,0 @@ if (typeof body === "string") { |
{ | ||
"name": "vi-fetch", | ||
"version": "0.7.2", | ||
"version": "0.8.0", | ||
"description": "Easiest way to mock fetch", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
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
39295
28
1234