Code Monkey home page Code Monkey logo

Comments (4)

dylanstanfield avatar dylanstanfield commented on June 7, 2024

Currently using this to workaround. Unfortunately it's a bit awkward because this needs to run before I import any file imports a model with the Collection annotation.

import * as fireorm from 'fireorm'
import * as MockFirebase from 'mock-cloud-firestore'

const firebase = new MockFirebase()
const firestore = firebase.firestore()
fireorm.Initialize(firestore)

from fireorm.

wovalle avatar wovalle commented on June 7, 2024

That's exactly the way I'm creating the unit tests with. About the MockRepository I don't have any clue about how it would look like 😄 Do you have examples/projects that I can follow?

@mamodom you're a software testing enthusiast, your opinion would be much appreciated!

from fireorm.

dylanstanfield avatar dylanstanfield commented on June 7, 2024

Is it possible to not throw the fireorm initialization error for model annotations are imported? Possibly throw when a resulting repository is used? I'd be happy to open a PR that adds the utility above.

import * as fireorm from 'fireorm'

fireorm.Initialize(fireorm.MockFirestore)
// or
fireorm.InitializeMock()

from fireorm.

wovalle avatar wovalle commented on June 7, 2024

I don't think fireorm should expose either MockFirestore or InitializeMock() because internally it would have to maintain a compatible mock api of firebase-admin/firestore which falls out of the scope of the library (at least for now).

I'll check how some libraries deal with testing to see what can be implemented.

Also, here I wrote why the initialization error is important. I'm open to suggestions to implement a better flow, though.

from fireorm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.