#nest-jest error of injeccion while run my test

1 messages Ā· Page 1 of 1 (latest)

somber fox
#

can you show us MasterDataModule

strong apex
#

yes I can

somber fox
#

that's weird

mild timber
#

Full error?

strong apex
mild timber
#

Where does master-dataConnection come from?

strong apex
#

Is a provider

mild timber
#

Great

#

Where does it come from?

strong apex
#

Wait

#

in mi app.module I include my database module
this module contains the two connections I use
then the database module looks like this (image 2):

#

good, Well, I imported the database module in my test and it worked, is it correct to do this?

somber fox
#

It depends
Are you making an unit test of CalculationService?

strong apex
#

yess

somber fox
#

So I don’t see any good reason to import other modules

strong apex
#

OK, now I get an error with configService

somber fox
#

Why?

#

You aren’t exercising that service

#

You shouldn’t have any error on that. Got it?

strong apex
#

My provider is used by the configServices to obtain the environment variables, is that why?

somber fox
#

Mock it then

#

Otherwise you’ll end up testing that another service as a side-effect

#

The post I’ve shared with you has basically everything you need to know in order to get no dependency resolution error on unit tests

strong apex
#

good