![]() Each item in the array is an array of arguments that were passed during the call.įor example: A mock function f that has been called twice, with the arguments f('arg1', 'arg2'), and then with the arguments f('arg3', 'arg4'), would have a mock. Īn array containing the call arguments of all calls that have been made to this mock function. line 30: you successfully can test that playSoundFile is being called and the argument with value of ‘song. But I have trouble handling the new constructor with parameters. The key is as jest.Mock at the end of this line. I have code that mocks TableName.query (hashkey).eq (myhashkey).exec () and similar queries. Returns the mock name string set by calling. 1 I need help mocking new TableName (params).save () used to create a new Dynamoose object in Jest. Mock functions allow you to test the links between code by erasing the actual implementation of a function, capturing calls to the function (and the parameters passed in those calls), capturing instances of constructor functions when instantiated with new, and allowing test-time configuration of return values.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |