NagRock / ts-mockito

Mocking library for TypeScript
MIT License
969 stars 93 forks source link

How to mock a builder pattern #225

Open atlanteh opened 2 years ago

atlanteh commented 2 years ago

let's say I have a builder class as following:

function dbAccess(query) {
  // do some stuff
  query.withPagination(somePagination).withOffset(someOffset).execute()
 // do some other stuff
}

I want to test dbAccess and verify that query was called with specific params. How do I do this?