DRFR0ST / bun-bagel

🥯 The Bun fetch mocker with a hole lot of flavor.
MIT License
17 stars 5 forks source link

Implement Mock class returned from the mock method #1

Open DRFR0ST opened 4 months ago

DRFR0ST commented 4 months ago

This PR will implement a Mock class that is returned from the mock method. It exposes several methods for cleaning the single mock, indication whether the mock was called and more.

Examples

const mockInstance = mock(url, options);

// ... call fetch to run the mock

console.log(mockInstance.called); // => true

mockInstance.clear();

// ... call fetch again to see the mock not being executed anymore.