I found an article similar to what I'm trying to do but the manual mocking here is also not helping. But i am not understating how to properly use jest. // No need to import aws-sdk in the test file, we will mock it! // ⚠️ Mock instance needs to be initialized before the module-in-test is required, // otherwise will get this error: // "ReferenceError: Cannot access 'mockIotDataInstance' before initialization" // // ⚠️ Variable name is ALSO IMPORTANT! It has to start with 'mock', // otherwise we will get this error: // "ReferenceError (.) // The module factory of `jest.mock()` is not allowed to reference any out-of-scope variables. If the module you are mocking is a Node module (e.g. SSM and KMS play nicely together as the most of AWS services. The problem is also that I would like to mock the constructors for both DynamoDB and DocumentClient class in my test file. How to mock S3 with jest Ask Question Asked 3 years, 4 months ago Modified 1 year, 3 months ago Viewed 38k times Part of AWS Collective 21 I am tryng to code a test for upload.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |