Socket
Socket
Sign inDemoInstall

spy4js

Package Overview
Dependencies
1
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.9.3 to 2.10.0

2

package.json
{
"name": "spy4js",
"version": "2.9.3",
"version": "2.10.0",
"description": "Smart, compact and powerful spy test framework",

@@ -5,0 +5,0 @@ "main": "dist/cjs/spy.js",

@@ -180,2 +180,3 @@ [![GitHub license][license-image]][license-url]

- `getAllCallArguments` (returns all call arguments for all calls in an array containing arrays)
- `getCallArguments` (returns all call arguments for a specified call in an array)

@@ -194,2 +195,4 @@ - `getCallArgument` (same as getCallArguments, but returns only a single element of the array)

spy.getAllCallArguments(); // returns [['string', 1], [[1, 2, 3]], [], [null]]
spy.getCallCount(); // returns 4
spy.getCallArguments(/* default = 0 */); // returns ['string', 1]

@@ -473,2 +476,9 @@ spy.getCallArgument(/* defaults = (0, 0) */); // returns 'string'

### getAllCallArguments
```
spy.getAllCallArguments() => Array<any[]>
```
Returns the call arguments of all made calls to the spy.
Especially returning an empty array if the spy was never called.
### getCallArguments

@@ -475,0 +485,0 @@ ```

@@ -31,2 +31,3 @@

wasNotCalledWith: (...args: any[]) => undefined,
getAllCallArguments: () => Array<any[]>,
getCallArguments: (callNr?: number) => any[],

@@ -33,0 +34,0 @@ getCallArgument: (callNr?: number, argNr?: number) => any,

@@ -89,2 +89,3 @@ /**

wasNotCalledWith: (...args: Array<any>) => void,
getAllCallArguments: () => Array<any[]>,
getCallArguments: (callNr?: number) => Array<any>,

@@ -511,2 +512,19 @@ getCallArgument: (callNr?: number, argNr?: number) => any,

/**
* This method returns all call arguments of all calls. Will be an empty
* array if the spy was never called.
*
* For example:
* const spy = new Spy();
* spy(arg1, arg2, arg3);
* spy(arg4, arg5, arg6);
* spy.getAllCallArguments();
* // returns [[arg1, arg2, arg3], [arg4, arg5, arg6]]
*
* @return {Array<any[]>} -> the call arguments of all calls.
*/
getAllCallArguments(): Array<any[]> {
return this[Symbols.calls];
},
/**
* This method returns the call arguments of the

@@ -529,3 +547,3 @@ * n'th made call as array. If less than n calls were made,

getCallArguments(callNr: number = 0): Array<any> {
const madeCalls = this[Symbols.calls];
const madeCalls = this.getAllCallArguments();
if (callNr % 1 !== 0 || callNr >= madeCalls.length) {

@@ -579,3 +597,3 @@ throw new Error(

getCallCount(): number {
return this[Symbols.calls].length;
return this.getAllCallArguments().length;
},

@@ -582,0 +600,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc