New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@asdgf/testing-helpers

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asdgf/testing-helpers - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

hanbi/index.js

@@ -1,1 +0,1 @@

var l=class{constructor(t){this._calls=new Set,this.original=t;let e=this;this.handler=function(...s){return e._handleCall.call(e,this,s)}}get called(){return this._calls.size>0}get calls(){return this._calls}getCall(t){return[...this._calls][t]}get firstCall(){return this.getCall(0)}get lastCall(){return this.getCall(this.callCount-1)}get callCount(){return this._calls.size}_handleCall(t,e){let r=this._returnFunction?this._returnFunction.apply(t,e):this._returnValue;return this._calls.add({args:e,thisValue:t,returnValue:r}),r}returns(t){this._returnFunction=void 0,this._returnValue=t}callsFake(t){this._returnValue=void 0,this._returnFunction=t}passThrough(){this.callsFake(this.original)}reset(){this._calls.clear()}restore(){this.restoreCallback&&this.restoreCallback()}calledWith(...t){return[...this.calls].some(e=>e.args.length===t.length&&e.args.every((r,s)=>t[s]===r))}returned(t){return[...this.calls].some(e=>e.returnValue===t)}},i=new Set;function a(n){return new l(n)}function u(){return new l(()=>{})}export{u as spy,a as stub};
var l=class{constructor(t){this._calls=new Set,this.original=t;let e=this;this.handler=function(...a){return e._handleCall.call(e,this,a)}}get called(){return this._calls.size>0}get calls(){return this._calls}getCall(t){return[...this._calls][t]}get firstCall(){return this.getCall(0)}get lastCall(){return this.getCall(this.callCount-1)}get callCount(){return this._calls.size}_handleCall(t,e){let s=this._returnFunction?this._returnFunction.apply(t,e):this._returnValue;return this._calls.add({args:e,thisValue:t,returnValue:s}),s}returns(t){this._returnFunction=void 0,this._returnValue=t}callsFake(t){this._returnValue=void 0,this._returnFunction=t}passThrough(){this.callsFake(this.original)}reset(){this._calls.clear()}restore(){this.restoreCallback&&this.restoreCallback()}calledWith(...t){return[...this.calls].some(e=>e.args.length===t.length&&e.args.every((s,a)=>t[a]===s))}returned(t){return[...this.calls].some(e=>e.returnValue===t)}},n=new Set;function u(r,t){let e=new l(r[t]);return r[t]=e.handler,e.restoreCallback=()=>{r[t]=e.original,n.delete(e)},n.add(e),e}function i(r){return new l(r)}function c(){return new l(()=>{})}function o(){for(let r of n)r.restore();n.clear()}export{o as restore,c as spy,i as stub,u as stubMethod};
{
"name": "@asdgf/testing-helpers",
"version": "0.0.1",
"version": "0.0.2",
"description": "A stupid simple way to test",

@@ -5,0 +5,0 @@ "type": "module",

@@ -12,3 +12,3 @@ # `@asdgf/testing-helpers`

```js
import { stub, spy } from '@asdgf/testing-helpers/hanbi/index.js';
import { spy, stub, stubMethod, restore } from '@asdgf/testing-helpers/hanbi/index.js';
```

@@ -35,3 +35,3 @@

import { describe } from '@asdgf/core';
import { stub, spy } from '@asdgf/testing-helpers/hanbi/index.js';
import * as hanbi from '@asdgf/testing-helpers/hanbi/index.js';
import { assert } from '@asdgf/testing-helpers/uvu/assert/index.js';

@@ -38,0 +38,0 @@ import { fixture, fixtureCleanup } from '@asdgf/testing-helpers/open-wc/index.js';

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