How to use the bocha.assert.equals function in bocha

To help you get started, we’ve selected a few bocha examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arnesten / smartdb / test / find.tests.js View on Github external
databases: [{
                url: 'http://myserver.com/animals',
                entities: {
                    fish: {}
                }
            }],
            mapDocToEntity: doc => new Fish(doc)
        });

        let result = await db.find('fish', 'byName', {
            selector: {
                name: 'Great white'
            }
        });

        assert.equals(result.length, 1);
        assert.equals(result[0], { _id: 'F1', name: 'Great white' });
        assert.equals(result[0].constructor, Fish);
    },
    'can find with implicit selector': async function () {
github arnesten / smartdb / test / find.tests.js View on Github external
entities: {
                    fish: {}
                }
            }],
            findHook() {
                throw new Error('Invalid');
            }
        });

        let err = await catchError(() => db.find('fish', 'byName', {
            selector: {
                name: 'Great white'
            }
        }));

        assert.equals(err.message, 'Invalid');
    },
    'can set a default find limit': async function () {
github arnesten / smartdb / test / find.tests.js View on Github external
let db = createDb({
            databases: [{
                url: 'http://myserver.com/animals',
                entities: {
                    fish: {}
                }
            }],
            mapDocToEntity: doc => new Fish(doc)
        });

        let result = await db.find('fish', 'byName', {
            name: 'Great white'
        });

        assert.equals(result.length, 1);
        assert.equals(result[0], { _id: 'F1', name: 'Great white' });
        assert.equals(result[0].constructor, Fish);
    },
    'can rewrite index name': async function () {
github arnesten / smartdb / test / find.tests.js View on Github external
entities: {
                    fish: {}
                }
            }],
            findHook(type, index, args) {
                args.foo = 'bar';
            }
        });

        let result = await db.find('fish', 'byName', {
            selector: {
                name: 'Great white'
            }
        });

        assert.equals(result, [{ _id: 'F1', name: 'Great white' }]);
    },
    'can use a hook to validate': async function () {
github arnesten / smartdb / test / find.tests.js View on Github external
databases: [{
                url: 'http://myserver.com/animals',
                entities: {
                    fish: {}
                }
            }],
            mapDocToEntity: doc => new Fish(doc)
        });

        let result = await db.find('fish', 'byName', {
            name: 'Great white'
        });

        assert.equals(result.length, 1);
        assert.equals(result[0], { _id: 'F1', name: 'Great white' });
        assert.equals(result[0].constructor, Fish);
    },
    'can rewrite index name': async function () {

bocha

Bringing the best of Buster.js to Mocha

MIT
Latest version published 1 month ago

Package Health Score

57 / 100
Full package analysis