In My NodeJS Application, Connecting to Sql-DB using tedious, I want to unit test the microservices related to DB. During the unit test I don't want connect real database. But I am getting the error
Error: Unable to connect database: Error:'.connect cannot be called on a connection in SentLogin7WithStandardLogin state
Can you recommend any suggestions?
I recommend using sinon to mock/stub database connection. It works if you use ORM library or native databas library. I usually use stub method like this:
Hope it helps you. Regards