-
Describe the bug
but i can't mock the orm property of the class, this is the test file im using, i use MikroORM.init and use that value for the mock
im getting this error because the MikroORM.init method is trying to connect to a database
i tried to set the option connect: false for the MikroORM.init method to no try to connect to any database like stated in this comment mikro-orm/nestjs-realworld-example-app#7 (comment)
i tried to ignore the typescript error with @ts-ignore but still i get the Exceeded timeout error also if i pass a empty to mock
i get this error
if i pass a empty object to the MikroORM.init method
i get an error too that says i must provide the options my question is: what is the recommended way to mock the orm:MikroORM property in a class that uses the UseRequestContext decorator? Versions
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Because it is not - it never was a config option, it is a second parameter to
If you pass empty object to the init method, you obviously get validation errors for the required things you havent provided. useValue: await MikroORM.init<MongoDriver>({type:'mongo',entities:[User,UserRole],dbName:'test'}, false) |
Beta Was this translation helpful? Give feedback.
-
thank you very much @B4nan its now working passing false as second argument, i have not seen that |
Beta Was this translation helpful? Give feedback.
Because it is not - it never was a config option, it is a second parameter to
MikroORM.init()
.If you pass empty object to the init method, you obviously get validation errors for the required things you havent provided.