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.
@gojob/wait-for-assertion
Advanced tools
Readme
A wrapper for asynchronous testing assertions.
yarn add @gojob/wait-for-assertion
# or
npm install @gojob/wait-for-assertion
By "asynchronous assertions", we means Assertions that must be executed with a delay. The typical use case that we want to avoid is the following:
await myFunctionWithAsyncSideEffects();
await new Promise(resolve => setTimeout(resolve, 1000)); // ❌ 🤢 🤮
expect(mySideEffectExists()).toBe(true);
waitForAssertion
will run the given function (containing assertions) until it stops throwing exceptions (which means that it "passed"), or will throw a Timeout error.
waitForAssertion
accepts up to three parameters:
function waitForAssertion(
assertion: () => any,
timeoutDelay: number = 1000,
intervalDelay: number = 100
);
assertion
: Closure containing asynchronous assertions to be made.timeoutDelay
: [1000ms] How long should the assertion be repeated until it passes (or times out).intervalDelay
: [100ms] How often should the assertion be repeated during timeoutDelay
.import { waitForAssertion } from '@gojob/wait-for-assertion';
// [...]
it('should asynchronously update the value in Elasticsearch', async () => {
await request(server)
.put(endpointURL)
.send(input)
.expect(HttpStatus.NO_CONTENT);
// the document is not immediatly available in Elasticsearch: wait
await waitForAssertion(async () => {
const { document } = await elasticsearchService.get(UserIndex, userId);
return expect(document.firstName).toBe(updatedUser.firstName);
});
});
Developed by VinceOPS at Gojob.
Initial blog story: 🇫🇷 article
FAQs
Wait for asynchronous testing assertions
The npm package @gojob/wait-for-assertion receives a total of 7 weekly downloads. As such, @gojob/wait-for-assertion popularity was classified as not popular.
We found that @gojob/wait-for-assertion demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.