mockserver-client-node icon indicating copy to clipboard operation
mockserver-client-node copied to clipboard

Add Promise support

Open hugoduraes opened this issue 3 years ago • 0 comments

Describe the feature request Add Promise support. The package methods are currently returning objects with a then property which make them look like they're returning Promises but are not. This goes against the TS type definitions which clearly indicate that the return type is a Promise!

What you are trying to do While implementing some integration tests using Jest and MockServer client, I've found that this package doesn't support Promises when I tried to do this:

await expect(mockServerClient.verify({ ... })).resolves.toBeUndefined();

The Jest expection still passes when an error is returned by verify method because verify is not returning a Promise!

The solution you'd like Promise support should be added, so that the above example can work. This can be achieved by wrapping the current methods with new Promise((resolve, reject) => {}) (configurable?) or by rewriting the whole package with Promises in mind.

hugoduraes avatar Nov 07 '22 11:11 hugoduraes