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

chai-spies-decorators

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-spies-decorators - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

48

chai-spies-decorators.js

@@ -25,31 +25,41 @@ import chai from 'chai'

const spied = chai.spy (desc.value)
const check = () => {
const memo = Symbol ()
let prev = undefined,
next = chai.expect (spied).to
return {
chain.forEach (what => {
configurable: desc.configurable,
enumerable: desc.enumerable,
if (Array.isArray (what)) { // call args
get () {
next = next.apply (prev, what) // prev.next (what)
/* memoization */
} else { // .what
if (this[memo]) {
return this[memo] }
else {
prev = next
next = next[what]
}
})
}
const spied = chai.spy (desc.value)
checklist.push (check)
checklist.push (() => {
return {
let prev = undefined,
next = chai.expect (spied).to
configurable: desc.configurable,
enumerable: desc.enumerable,
chain.forEach (what => {
get () {
return (...args) => spied.apply (this, args)
if (Array.isArray (what)) { // call args
next = next.apply (prev, what) // prev.next (what)
} else { // .what
prev = next
next = next[what]
}
})
})
return (this[memo] = spied)
}
}

@@ -56,0 +66,0 @@ }

{
"name": "chai-spies-decorators",
"version": "0.0.5",
"version": "0.0.6",
"description": "Chai Spies + ES7 decorators",

@@ -5,0 +5,0 @@ "main": "chai-spies-decorators.js",

@@ -12,9 +12,15 @@ import './chai-spies-decorators'

const foo = new (class Foo {
class Foo {
@will.have.been.called.with ('qux').once
bar (qux) { return qux + qux }
})
bar (qux) {
return qux + qux
}
}
foo.bar ('qux').should.equal ('quxqux')
const foo1 = new Foo ()
const foo2 = new Foo ()
foo1.bar ('qux').should.equal ('quxqux')
foo2.bar ('qux').should.equal ('quxqux')
})

@@ -55,6 +61,6 @@

@will.have.been.called.once
bar () { }
bar () { this.should.equal (foo) }
@will.have.been.called.twice
baz () { }
baz () { this.should.equal (foo) }
})

@@ -61,0 +67,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