Relative Content

Tag Archive for typescriptunit-testingjestjsnestjs

class import error when runing test with Jest

this is my first time i use Jest for testing so when I tried to run my unit test it fail because the import of communicationManagerService (actualy it call the coreManager.MessageSubject which is not used in my OutCallManager class)
this is my class :

How to mock optional methods as undefined in Jest?

I am writing unit tests for a NestJS/Express server that uses the express-session package. It has an object with methods that might not always be defined. In my code I check for it to exist first, like this: