meeshkan / unmock-js

Fuzz test your REST API calls
https://unmock.io
93 stars 8 forks source link

Add unmock.mock to replace unmock.nock. #402

Closed ksaaskil closed 4 years ago

ksaaskil commented 4 years ago

Why the change? Now that we're targeting environments beyond Node.js, users cannot be expected to be familiar with nock. I also think it's better to make it clear that unmock-js is a standalone and independent library not designed as "nock alternative".

What do you think? @mikesol @carolstran

codecov[bot] commented 4 years ago

Codecov Report

Merging #402 into dev will increase coverage by 0.02%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #402      +/-   ##
==========================================
+ Coverage   79.91%   79.93%   +0.02%     
==========================================
  Files          59       59              
  Lines        2579     2582       +3     
  Branches      609      609              
==========================================
+ Hits         2061     2064       +3     
  Misses        518      518              
Impacted Files Coverage Δ
packages/unmock-core/src/service/serviceStore.ts 81.15% <ø> (ø)
packages/unmock-core/src/faker/index.ts 82.35% <100.00%> (+0.53%) :arrow_up:
packages/unmock-core/src/index.ts 80.00% <100.00%> (+0.40%) :arrow_up:
packages/unmock-node/src/index.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2dd3379...c38b87f. Read the comment docs.

mikesol commented 4 years ago

Super cool. Allows us to do stuff like:

import unmock as un, { u } from 'unmock';
un.mock("https://api.petstore.io").get("/pets").reply(200, u.array({id: u.integer()}));