diff --git a/src/backend/mocks/default_handlers.js b/src/backend/mocks/default_handlers.js index 01ad49c9..52ee8265 100644 --- a/src/backend/mocks/default_handlers.js +++ b/src/backend/mocks/default_handlers.js @@ -168,11 +168,11 @@ export const handlers = [ }), 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 @@ export const handlers = [ return Response.json({ items }) }), + + // 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 }) + }), ]