axios-mock-shim
Advanced tools
Comparing version 1.1.9 to 1.1.10
@@ -97,2 +97,3 @@ /* eslint-disable */ | ||
const cacheToken = stringify(configs); | ||
const useOnce = true; | ||
// Return an object to define mock data & calling | ||
@@ -114,3 +115,3 @@ return { | ||
return this; // if dont use mock, return this. | ||
_mock.call(parent, configs, false); | ||
_mock.call(parent, configs, !useOnce); | ||
return this; | ||
@@ -122,3 +123,3 @@ }, | ||
return this; // if dont use mock, return this. | ||
_mock.call(parent, configs, true); | ||
_mock.call(parent, configs, useOnce); | ||
return this; | ||
@@ -128,4 +129,4 @@ }, | ||
// "run" will become a function, eg. "() => this._useMockRequest()" | ||
run: parent.runBuilder.call(parent, configs, false), | ||
runOnce: parent.runBuilder.call(parent, configs, true) | ||
run: parent.runBuilder.call(parent, configs, !useOnce), | ||
runOnce: parent.runBuilder.call(parent, configs, useOnce) | ||
}; | ||
@@ -132,0 +133,0 @@ }, |
{ | ||
"name": "axios-mock-shim", | ||
"version": "1.1.9", | ||
"version": "1.1.10", | ||
"description": "A plugin build for easily using axios-mock-adapter with axios", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -28,3 +28,3 @@ # Axios Mock Shim | ||
- **createAxios(axiosConfig)** | ||
#### **createAxios(axiosConfig)** | ||
@@ -42,3 +42,3 @@ Create Axios instance by given config.(default config or your custom config) | ||
- **createAPIHandler(axiosInstance, shimOptions)** | ||
#### **createAPIHandler(axiosInstance, shimOptions)** | ||
@@ -68,3 +68,3 @@ Create an `AxiosRequest` object, which you can then use to define & call the api with specific mock data. | ||
- **use(method, svc, data)** | ||
#### **- use(method, svc, data)** | ||
@@ -87,3 +87,3 @@ Define the api setting | ||
- **with(replyHandler)** | ||
#### **- with(replyHandler)** | ||
@@ -101,3 +101,3 @@ Define the mock reply data. | ||
- **mock** | ||
#### **- mock** | ||
@@ -119,4 +119,8 @@ Trigger the mock feature without calling run, by default, calling `run` will trigger mock automatically, but sometimes we just want to define specific response with some params. | ||
- **run()** | ||
#### **- mockOnce()** | ||
calling the mock with `replyOnce`, with only mock request once. | ||
#### **- run()** | ||
Execute the `AxiosRequest`, will execute real request by axios with auto checking for mock cache, if there's no cache yet, will mock & cache the result. | ||
@@ -161,2 +165,8 @@ | ||
#### **- runOnce()** | ||
Same behavior to `run`, but would just mock once. same action as `mockOnce` + `run`. | ||
## Options | ||
@@ -163,0 +173,0 @@ |
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
22628
425
332