npm.io
3.2.6 • Published 2 years ago

@types/node-mongodb-fixtures

Licence
MIT
Version
3.2.6
Deps
2
Size
5 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/node-mongodb-fixtures

Summary

This package contains type definitions for node-mongodb-fixtures (https://github.com/cdimascio/node-mongodb-fixtures#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-mongodb-fixtures.

index.d.ts

import { MongoClientOptions } from "mongodb";

/**
 * Setup and tear down test fixtures with MongoDB.
 *
 * Use custom scripts to create indexes and more!
 *
 * @see https://www.npmjs.com/package/node-mongodb-fixtures
 */
declare class Fixtures {
    constructor(options?: Fixtures.Options);

    /**
     * @param uri MongoDB connection string.
     *
     * @param options MongoDB connection options.
     *
     * @param dbName Identifies a database to switch to. Useful when the db in the connection string differs from the db you want to connect to.
     */
    connect(uri: string, options?: MongoClientOptions, dbName?: string): Promise<this>;

    load(): Promise<this>;

    unload(): Promise<this>;

    disconnect(): Promise<void>;
}

declare namespace Fixtures {
    interface Options {
        /**
         * Specifiy the fixtures directory or default to `./fixtures`.
         */
        dir?: string | undefined;

        /**
         * Filter the fixtures present in the directory with a regex pattern.
         */
        filter?: string | undefined;

        /**
         * Specify `true` to mute the log output or default to `false`.
         */
        mute?: boolean | undefined;
    }
}

export = Fixtures;

Additional Details

Credits

These definitions were written by Chuah Chee Shian (shian15810).