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

custom-ability

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

custom-ability - npm Package Compare versions

Comparing version 2.0.0-alpha.7 to 2.0.0

6

package.json
{
"name": "custom-ability",
"version": "2.0.0-alpha.7",
"version": "2.0.0",
"description": "make custom ability more easy. generate the ability which can be added to any class directly.",

@@ -39,4 +39,4 @@ "homepage": "https://github.com/snowyu/custom-ability.js",

"dependencies": {
"inherits-ex": "^2.1.0-alpha.12",
"util-ex": "^2.0.0-alpha.10"
"inherits-ex": "^2.1.0",
"util-ex": "^2.0.0"
},

@@ -43,0 +43,0 @@ "devDependencies": {

@@ -388,5 +388,10 @@ import chai, { expect } from 'chai';

it('should inject class methods', function() {
var My, newExec, oldExec;
My = function() {};
My.exec = oldExec = sinon.spy(function() {});
let newExec;
const oldExec = sinon.spy(function() {})
class My {
static exec: any = oldExec;
}
testable(My, {

@@ -405,2 +410,28 @@ classMethods: {

});
it('should inject class method in parent', function() {
let newExec;
const oldExec = sinon.spy(function() {})
class MyRoot {
static exec: any = oldExec;
}
class My extends MyRoot { }
testable(My, {
classMethods: {
exec: newExec = sinon.spy(function() {
this['super'].apply(this.self, arguments);
})
}
});
My.exec(1, 2, 3);
newExec.should.be.calledOnce;
newExec.should.be.calledWith(1, 2, 3);
oldExec.should.be.calledOnce;
oldExec.should.be.calledWith(1, 2, 3);
});
//assert.equal oldExec, true, 'should execute the original func'

@@ -407,0 +438,0 @@ //assert.equal newExec, true, 'should execute the new func'

@@ -365,2 +365,21 @@ import chai from 'chai';

});
it('should inject class methods in parent', function() {
var My, MyRoot, newExec, oldExec;
MyRoot = function() {};
My = function() {};
inherits(My, MyRoot);
MyRoot.exec = oldExec = sinon.spy(function() {});
testable(My, {
classMethods: {
exec: newExec = sinon.spy(function() {
this['super'].apply(this.self, arguments);
})
}
});
My.exec(1, 2, 3);
newExec.should.be.calledOnce;
newExec.should.be.calledWith(1, 2, 3);
oldExec.should.be.calledOnce;
oldExec.should.be.calledWith(1, 2, 3);
});
it('should not inject methods twice', function() {

@@ -367,0 +386,0 @@ var My, Root, my, newExec, oldExec;

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