Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
chai-callslike
Advanced tools
Changelog
1.2.8
Readme
A simple assertion to validate many aspects of stub calls. It is supposed to use with sinon + chai.
Will validate the exactly interaction with the mocked method, which is:
It is pretty simple to setup the chai-callslike in your tests:
import chai from 'chai'
import {callsLike} from 'chai-callslike'
chai.use(callsLike)
Just pass the stub in the first parameter and, in the others, arrays with the set of parameters each calls had received.
expect(myStub).callsLike(
['param1call1', 'param2call1', 'param3call1'],
['param1call2', 'param2call2', 'param3call2'],
);
If you want to check if the stub had never been called, pass just the stub:
expect(myStub).callsLike();
If you expect the stub to have been called with no parameters, pass empty arrays:
expect(myStub).callsLike([], [], [])
(in this example, myStub have been called three times with no parameters)
You can also use sinon matchers to validate the parameters instead of exact values:
expect(myStub).callsLike(
[sinon.match.object, sinon.match.string, sinon.match(/.+foo.+goo/)]
);
The generated log will look pretty as this:
For more info look into the Full API Reference.
FAQs
A simple sinon-chai assertion to validate many aspects of stub calls
The npm package chai-callslike receives a total of 96 weekly downloads. As such, chai-callslike popularity was classified as not popular.
We found that chai-callslike demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.