
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
jasmine-spy-helpers
Advanced tools
jasmine-spy-helpers adds some helper functions to Jasmine.
jasmine-spy-helpers is compatible with Jasmine 2.0+, but it will track with the current Jasmine version.
jasmine.spyAll(object)
callThrough
it('should spy all methods', function() {
var obj = {
id: 1,
method1: function() {
},
method2: function() {
}
};
jasmine.spyAll(obj);
expect(obj.method1).not.toHaveBeenCalled();
expect(obj.method2).not.toHaveBeenCalled();
});
jasmine.spyIf(function)
it('should spy method once', function() {
var obj = {
id: 1,
method1: function() {
},
method2: function() {
}
};
jasmine.spyIf(obj, 'method1');
jasmine.spyIf(obj, 'method1');
});
jasmine.spyAllExcept(object, [excepts])
callThrough
it('should spy selected method', function() {
var obj = {
id: 1,
method1: function() {
},
method2: function() {
}
};
jasmine.spyAllExcept(obj, 'method2');
});
jasmine.spyEach(object, [only])
callThrough
it('should spy selected method', function() {
var obj = {
id: 1,
method1: function() {
},
method2: function() {
},
method3: function() {
}
};
jasmine.spyEach(obj, ['method1', 'method2');
});
jasmine.resetAll(object)
it('should reset all methods', function() {
var obj = {
id: 1,
method1: function() {
},
method2: function() {
}
};
spyOn(obj, 'method1');
spyOn(obj, 'method2');
obj.method1();
obj.method2();
expect(obj.method1).toHaveBeenCalled();
expect(obj.method2).toHaveBeenCalled();
jasmine.resetAll(obj);
expect(obj.method1).not.toHaveBeenCalled();
expect(obj.method2).not.toHaveBeenCalled();
});
jasmine.resetEach(object, [methods])
it('should reset all methods', function() {
var obj = {
id: 1,
method1: function() {
},
method2: function() {
}
};
spyOn(obj, 'method1');
spyOn(obj, 'method2');
obj.method1();
obj.method2();
expect(obj.method1).toHaveBeenCalled();
expect(obj.method2).toHaveBeenCalled();
jasmine.resetEach(obj, ['method1']);
expect(obj.method1).not.toHaveBeenCalled();
expect(obj.method2).toHaveBeenCalled();
});
jasmine.resetAllExcept(object, [methods])
it('should reset all methods', function() {
var obj = {
id: 1,
method1: function() {
},
method2: function() {
}
};
spyOn(obj, 'method1');
spyOn(obj, 'method2');
obj.method1();
obj.method2();
expect(obj.method1).toHaveBeenCalled();
expect(obj.method2).toHaveBeenCalled();
jasmine.resetAllExcept(obj, ['method1']);
expect(obj.method1).toHaveBeenCalled();
expect(obj.method2).not.toHaveBeenCalled();
});
MIT License (MIT)
A lot of code was borrowed from jasmine-utils, but I was looking to create just the spy helpers.
Open to pull requests.
FAQs
Updated jasmine spy helpers for less boilerplate code.
The npm package jasmine-spy-helpers receives a total of 7 weekly downloads. As such, jasmine-spy-helpers popularity was classified as not popular.
We found that jasmine-spy-helpers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.