Repository navigation
msw: add mock handlers for policy endpoints #1199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
deer-wmde
wants to merge
30
commits into
main
Choose a base branch
from
de/msw-policies
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
91e86b5
adjust main.js
deer-wmde fac3371
migrate login mock handlers
deer-wmde 1e57ddd
add verify email handlers
deer-wmde 66370a5
add complaint and contact message handlers
deer-wmde de51e27
migrate remaining old handlers
deer-wmde 9cd23e6
formatting
deer-wmde 7c9fdc1
fix obj access
deer-wmde b553dda
fix wiki details response
deer-wmde cdef995
Merge branch 'main' into de/msw-continue
deer-wmde ea156d7
Merge branch 'main' into de/msw-continue
deer-wmde 43d67df
strcit type checks
deer-wmde ad97409
fix create wiki response
deer-wmde 05e073a
Merge branch 'main' into de/msw-continue
deer-wmde de0e487
Merge branch 'main' into de/msw-continue
deer-wmde 77bb18a
add handler for current policy
deer-wmde 0e20438
disable mock bypass
deer-wmde 643823a
fix removeWiki
deer-wmde 4930074
fix user
deer-wmde 7d8696f
fix entityimport handler
deer-wmde 108889c
formatting
deer-wmde 132b2e9
remove obsolete note
deer-wmde eca0ae4
policies handlers
deer-wmde e965bba
formatting
deer-wmde b1bb6e0
Merge branch 'main' into de/msw-policies
deer-wmde 4d9a0d1
Merge branch 'main' into de/msw-policies
deer-wmde 9aa1799
Merge branch 'main' into de/msw-policies
deer-wmde 77cf949
Merge branch 'main' into de/msw-policies
deer-wmde 5598b16
Merge branch 'main' into de/msw-policies
deer-wmde a10720d
adjust api response message
deer-wmde 12ace28
add comment
deer-wmde File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,11 +168,11 @@ | |
| }), | ||
|
|
||
| http.post('/api/user/sendVerifyEmail', () => { | ||
| return new Response('Already verified') | ||
| return new Response('Already verified!') | ||
| }), | ||
|
|
||
| http.post('/api/user/verifyEmail', () => { | ||
| return new Response('Already verified') | ||
| return new Response('Already verified!') | ||
| }), | ||
|
|
||
| http.post('/api/complaint/sendMessage', () => { | ||
|
|
@@ -290,4 +290,87 @@ | |
|
|
||
| return Response.json({ items }) | ||
| }), | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think It will be beneficial to add a comment here about these requiring an update every time there are new policies.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good call! |
||
| // Currently in this form this needs to be kept in sync with new policies added in the future | ||
| // TODO: find a way to test different scenarios of policy states | ||
| http.get('/api/v1/policies/terms-of-use', () => { | ||
| const items = [ | ||
| { | ||
| metadata: { | ||
| policy_id: 1, | ||
| type: 'terms-of-use', | ||
| active_from: '2022-01-01', | ||
| content_vue_file: 'terms-of-use/version-1.vue', | ||
| }, | ||
| }, | ||
| { | ||
| metadata: { | ||
| policy_id: 2, | ||
| type: 'terms-of-use', | ||
| active_from: '2026-08-27', | ||
| content_vue_file: 'terms-of-use/version-2.vue', | ||
| }, | ||
| }, | ||
| ] | ||
|
|
||
| return Response.json({ items }) | ||
| }), | ||
|
|
||
| http.get('/api/v1/policies/terms-of-use/by_active_from/2022-01-01', () => { | ||
| const metadata = { | ||
| policy_id: 1, | ||
| type: 'terms-of-use', | ||
| active_from: '2022-01-01', | ||
| content_vue_file: 'terms-of-use/version-1.vue', | ||
| } | ||
|
|
||
| return Response.json({ metadata }) | ||
| }), | ||
|
|
||
| http.get('/api/v1/policies/terms-of-use/current', () => { | ||
| const metadata = { | ||
| policy_id: 2, | ||
| type: 'terms-of-use', | ||
| active_from: '2026-08-27', | ||
| content_vue_file: 'terms-of-use/version-2.vue', | ||
| } | ||
|
|
||
| return Response.json({ metadata }) | ||
| }), | ||
|
|
||
| http.get('/api/v1/policies/terms-of-use/upcoming', () => { | ||
| const message = 'Policy not found.' | ||
| return Response.json({ message }, { status: 404 }) | ||
| }), | ||
|
|
||
| http.get('/api/v1/policies/hosting-policy', () => { | ||
| const items = [ | ||
| { | ||
| metadata: { | ||
| policy_id: 3, | ||
| type: 'hosting-policy', | ||
| active_from: '2026-08-27', | ||
| content_vue_file: 'hosting-policy/version-1.vue', | ||
| }, | ||
| }, | ||
| ] | ||
|
|
||
| return Response.json({ items }) | ||
| }), | ||
|
|
||
| http.get('/api/v1/policies/hosting-policy/current', () => { | ||
| const metadata = { | ||
| policy_id: 3, | ||
| type: 'hosting-policy', | ||
| active_from: '2026-08-27', | ||
| content_vue_file: 'hosting-policy/version-1.vue', | ||
| } | ||
|
|
||
| return Response.json({ metadata }) | ||
| }), | ||
|
|
||
| http.get('/api/v1/policies/hosting-policy/upcoming', () => { | ||
| const message = 'Policy not found.' | ||
| return Response.json({ message }, { status: 404 }) | ||
| }), | ||
| ] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.