
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
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 799 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
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.