Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-mock

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-mock - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

index.d.ts

8

index.js

@@ -181,2 +181,10 @@ /* global define */

newFn.withActions = function (actions) {
wrappedFn = stubFn
if (actions && actions.length >= 0) {
Array.prototype.push.apply(newFn.actions, actions)
}
return newFn // Chainable
}
newFn.callOriginal = newFn.callOriginalFn = function () {

@@ -183,0 +191,0 @@ wrappedFn = stubFn

2

package.json
{
"name": "simple-mock",
"version": "0.7.1",
"version": "0.7.2",
"description": "Super simple stubs and spies with 1-step sandbox restore",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -159,3 +159,3 @@ # simple-mock

### spy.restore()
### spy.reset()

@@ -207,2 +207,26 @@ Resets all counts and properties to the original state.

Note: modifying this array directly is not supported, rather use stub.withActions(actions) if you need to add actions.
### stub.withActions(actions) *or* stub.withActions()
Configures this stub to use the specified array of actions. See `stub.actions` above for the syntax of an action.
```js
var fn = simple.stub()
.returnWith('a')
.withActions([{ returnValue: 'b' }, { returnValue: 'c' }])
.returnWith('d')
var returned1 = fn()
var returned2 = fn()
var returned3 = fn()
var returned4 = fn()
assert.equal(fn.callCount, 4)
assert.equal(returned1, 'a')
assert.equal(returned2, 'b')
assert.equal(returned3, 'c')
assert.equal(returned4, 'd')
```
### stub.loop

@@ -209,0 +233,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc