Skip to content

A library for inserting your test fixtures into the MongoDb for Dart.

License

Notifications You must be signed in to change notification settings

vshushkov/mongo_fixtures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MongoFixtures library for Dart

Build Status Pub

A library for inserting your test fixtures into the MongoDb using mongo_dart.

Usage

A simple usage example:

import 'package:mongo_fixtures/mongo_fixtures.dart' as fixtures;

List<fixtures.Entity> fixturesProvider(fixtures.Loader loader) {
    return [

        new fixtures.Collection('some_collection')
            ..insert(map: {
                'field_one': 'value1',
                'field_two': 'value2',
                'field_three': loader.document('document').field('another_field_one'),
            }),

        new fixtures.Collection('some_another_collection')
            ..insert(map: {
                'another_field_one': 'value3',
                'another_field_two': 'value4',
                'another_field_three': loader.document('document').id(),
                'another_field_four': loader.document('document').idAsHexString()
            })
            ..insert(label: 'document', map: {
                'another_field_one': 'value3',
                'another_field_two': 'value4',
            })

    ];
}

main() {

    group('test group', () {

        setUp(() {
            return new fixtures.Loader('mongodb://127.0.0.1/db_for_test')
                .cleanAllAndInsert(fixturesProvider);
        });

        ...

    });
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

About

A library for inserting your test fixtures into the MongoDb for Dart.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages