lundi 5 septembre 2016

Proxyquire and functions import

I m trying to use proxyquire to simulate an express behaviour and I m having some trouble dealing with the following command :

expressProxy = () => {
      return {
        use: () => true,
        post: () => true,
        listen: () => true
      }
    }

Application = proxyquire('./../app', {
      'express': expressProxy,
      'passport': passportProxy,
      './app/business/service/StrategyFactory': StrategyFactoryProxy
    })

When I start my application using the following code :

Application.main()

I m always having the full express behaviour, as it should normally work.

I m having the full and complete express object just as if it hasn't been redefined...

I m a bit lost and I dont understand what's going on here.

Any information to help me understand ?

Aucun commentaire:

Enregistrer un commentaire