New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mongo-test-suit

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongo-test-suit

A set of helper tools to test mongo-based projects

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

A set of helper utility functions that makes testing MongoDB-based projects quick, nimble and readable. Written in Typescript.

Installation

NPM Info

Build Status

Example usage

import { initializeTestDB, getCollectionSnapshot, flushDb, closeDb } from 'mongo-test-suit'
import * as randomString from 'randomstring'
import { ObjectId } from 'mongodb'

const dbName = `my-db-${randomString.generate(7)}`
const uri = `mongodb://localhost/${dbName}`

beforeAll(async () => {
  await initializeTestDB(uri)
})

afterAll(async () => {
  await flushDb()
  await closeDb()
})

describe('myNeatFunction()', () => {
  test('It does what you think it does', async () => {
    // Go about your business
    // Now get a snapshot of the collection
    expect(await getCollectionSnapshot({ collectionName: 'MyCollection' })).toMatchSnapshot()
  })
})

Full API documentation here

Author

Ehab Khaireldin

License

This project is licensed under the MIT License

Keywords

FAQs

Package last updated on 17 Dec 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc