firebase-database-mock

0.2.0 • Public • Published

firebase-database-mock

An in-memory database that resembles firebase database api, useful for writing unit tests.

Usage

const Database = require('firebase-database-mock');

const data = {
    words: {
        one: 'hello',
        two: 'world'
    }
};

const db = Database.createInMemoryDatabase(data);

// lets do some reading
db.ref('words)
    .then(snapshot => {
        const values = snapshot.val();
        console.log(values.one);    // 'hello'
        console.log(values.two);    // 'world'
    });

Readme

Keywords

none

Package Sidebar

Install

npm i firebase-database-mock

Weekly Downloads

0

Version

0.2.0

License

ISC

Unpacked Size

4.71 kB

Total Files

8

Last publish

Collaborators

  • ilbesculpi