
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
Assertion library for unit testing JS generators. Works well with redux-saga. Allows snapshot testing.
As in "expect generator...". An assertion / snapshot library for testing iterators and generators. It was designed for, and works particularly well with, redux-saga but can be used for anything that uses generators.
function* myEffect(fakeAction) {
const fooIds = yield select(fooIds);
yield put(foosLoading());
const results = yield call(apiFetch, options);
}
import expectGen from 'expect-gen';
it('runs effect with fakeFooIds and fakeResults', () => {
expectGen(myEffect, fakeAction)
// asserts step yields first `select(fooIds)`
.yields(
select(fooIds),
// `fakeFooIds` gets pass into the following `next`
fakeFooIds
)
.yields(
put(foosLoading())
)
.yields(
call(apiFetch, options),
fakeResults
)
.finishes()
.run();
});
it('runs effect with fakeFooIds and fakeResults', () => {
const snapshot = expectGen(myEffect, fakeAction)
// Doesn't run assertion for `next`
.next(fakeFooIds)
.next()
.yields(
call(apiFetch, options),
fakeResults
)
.finishes()
.toJSON();
expect(snapshot).toMatchSnapshot();
});
expectGen(generator, [...args])
StepManagerexpectGen returns an instance StepManager. It gives us a set of chainable methods:
expectGen(generator, [...args])
.yields(expectedValue, [result])
expectedValueresult into generator's next methodStepManagerexpectGen(generator, [...args])
.next([result])
result into generator's next methodStepManagerexpectGen(generator, [...args])
.throws(error)
error into generatorStepManagerexpectGen(generator, [...args])
.catches(error, [expectedValue])
error into generatorexpectedValueStepManagerexpectGen(generator, [...args])
.catchesAndFinishes(error, [result])
error into generatorresultStepManagerexpectGen(generator, [...args])
...
.finishes([result])
resultStepManagerexpectGen(generator, [...args])
...
.run()
expectGen(generator, [...args])
...
.toJSON()
run() into a JSON objectExpect Gen is heading towards v1. The following items still need to go in before then. Please open issues for other v1 requirements you find.
Expect Gen is a second generation version of generator-test-runner. Many of the concepts used here originated there.
FAQs
Assertion library for unit testing JS generators. Works well with redux-saga. Allows snapshot testing.
The npm package expect-gen receives a total of 673 weekly downloads. As such, expect-gen popularity was classified as not popular.
We found that expect-gen 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.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.