Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
mongo-scenario
Advanced tools
Quickly and accurately create test data in a MongoDB for repeatable and reliable integration tests.
yarn add -D mongo-scenario
./scenarios/one.yml
description: A basic test scenario
data:
- users:
- one:
_id: 1
name: John
email: john@foo.bar
- two:
_id: 2
name: Jane
email: jane@foo.bar
- tasks:
- three:
name: Take out trash
user: 2
- four:
name: Grocery shopping
user: 1
foo.spec.js
import Scenario from 'mongo-scenario'
const db = connectToMongo()
const scenario = new Scenario(db)
describe('my test', () => {
before(() => {
scenario.load('one')
})
after(() => {
scenario.unloadAll()
})
it('has the data', () => {
assert(users.list.length, 2)
})
})
In the trivial example above, we describe our scenario in terms of the data that we want loaded into our MongoDB. In the setup code of our test, we then load up a new database connection and pass it to the mongo-scenario
constructor. In the before block we load the specified scenario that we want to run tests against. The final step in the after block is to unload the scenario, in this case we unload all scenarios that may be loaded.
At it's heart, mongo-scenario
is nothing more than a YAML to JavaScript parser that inserts and deletes specific records into a running MongoDB instance. Which MongoDB instance does it use? Any one that give it. It could be a seven shard atlas cluster, a local test database or even in memory.
FAQs
Generate sample data in MongoDB for running integration tests
The npm package mongo-scenario receives a total of 2 weekly downloads. As such, mongo-scenario popularity was classified as not popular.
We found that mongo-scenario 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
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.