Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Add Mock Service Worker #962

Merged
merged 12 commits into from
Mar 8, 2021
Merged

Add Mock Service Worker #962

merged 12 commits into from
Mar 8, 2021

Conversation

washingtonsoares
Copy link
Contributor

Issue Description

Currently we don't have a mechanism to mock requests from the backend, moreover, we have a very bad way of mocking requests in unit tests.

Solution

Introducing Mock Service Worker

Mock Service Worker is an API mocking library that uses Service Worker API to intercept actual requests and works fine on both browser and node environment

See more at: https://mswjs.io/docs/

@boring-cyborg boring-cyborg bot added the ui Improvements/additions/fixes for ui module. label Mar 5, 2021
Signed-off-by: Washington Soares <washingtonudi@gmail.com>
@codecov
Copy link

codecov bot commented Mar 5, 2021

Codecov Report

Merging #962 (fb6a960) into main (1ed5140) will increase coverage by 0.04%.
The diff coverage is 91.66%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #962      +/-   ##
============================================
+ Coverage     77.44%   77.48%   +0.04%     
  Complexity     1978     1978              
============================================
  Files          1181     1192      +11     
  Lines         16378    16390      +12     
  Branches       1489     1489              
============================================
+ Hits          12684    12700      +16     
+ Misses         3219     3217       -2     
+ Partials        475      473       -2     
Flag Coverage Δ Complexity Δ
ui 80.45% <91.66%> (+0.08%) 0.00 <0.00> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
ui/src/mocks/browser.ts 0.00% <0.00%> (ø) 0.00 <0.00> (?)
ui/src/mocks/handlers.ts 100.00% <100.00%> (ø) 0.00 <0.00> (?)
ui/src/mocks/handlers/auth/index.ts 100.00% <100.00%> (ø) 0.00 <0.00> (?)
ui/src/mocks/handlers/auth/responses.ts 100.00% <100.00%> (ø) 0.00 <0.00> (?)
ui/src/mocks/handlers/circleMatcher/index.ts 100.00% <100.00%> (ø) 0.00 <0.00> (?)
ui/src/mocks/handlers/circleMatcher/responses.ts 100.00% <100.00%> (ø) 0.00 <0.00> (?)
ui/src/mocks/handlers/users/index.ts 100.00% <100.00%> (ø) 0.00 <0.00> (?)
ui/src/mocks/handlers/users/responses.ts 100.00% <100.00%> (ø) 0.00 <0.00> (?)
ui/src/mocks/handlers/workspaces/index.ts 100.00% <100.00%> (ø) 0.00 <0.00> (?)
ui/src/mocks/handlers/workspaces/responses.ts 100.00% <100.00%> (ø) 0.00 <0.00> (?)
... and 13 more

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 1ed5140...a421059. Read the comment docs.

@@ -0,0 +1,320 @@
/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity: This is an auto generated file

@washingtonsoares washingtonsoares marked this pull request as ready for review March 8, 2021 12:06
bCatanant
bCatanant previously approved these changes Mar 8, 2021
Signed-off-by: Washington Soares <washingtonudi@gmail.com>
Signed-off-by: Washington Soares <washingtonudi@gmail.com>
@washingtonsoares washingtonsoares merged commit b9f4de6 into main Mar 8, 2021
@washingtonsoares washingtonsoares deleted the add-mock-service-worker branch March 8, 2021 18:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ui Improvements/additions/fixes for ui module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants