Skip to content

Commit

Permalink
Refactor WireMock stubs for clarity
Browse files Browse the repository at this point in the history
Use consistent data across the editor and frontend, and assign more descriptive names to stubs.
  • Loading branch information
kasperbirch1 committed Apr 24, 2024
1 parent 04a5774 commit 0242b8b
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 772 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"id": "f17d80cb-0e88-46f5-910a-07d9b803d2c3",
"name": "Opening hours create instance",
"request": {
"url": "/dpl_opening_hours?_format=json",
"method": "POST"
},
"response": {
"status": 200,
"body": "[ \n {\n \"id\": {{randomValue length=3 type='NUMERIC'}},\n \"category\": {\n \"title\": \"{{jsonPath request.body '$.category.title'}}\",\n \"color\": \"{{jsonPath request.body '$.category.color'}}\"\n },\n \"date\": \"{{jsonPath request.body '$.date'}}\",\n \"start_time\": \"{{jsonPath request.body '$.start_time'}}\",\n \"end_time\": \"{{jsonPath request.body '$.end_time'}}\",\n \"branch_id\": {{jsonPath request.body '$.branch_id'}},\n \"repetition\": {\n \"id\": {{randomValue length=3 type='NUMERIC'}},\n \"type\": \"{{jsonPath request.body '$.repetition.type'}}\",{{#if (eq (jsonPath request.body '$.repetition.type') 'weekly')}}\"weekly_data\": {{{jsonPath request.body '$.repetition.weekly_data'}}}{{/if}}\n }\n }\n]",
"headers": {
"Content-Type": "application/json"
},
"transformers": ["response-template"]
},
"uuid": "f17d80cb-0e88-46f5-910a-07d9b803d2c3",
"persistent": true,
"priority": 5,
"insertionIndex": 1,
"postServeActions": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"id": "b03cdd7c-c1e0-4e35-b374-f429642e379f",
"name": "Opening hours current week",
"request": {
"url": "/dpl_opening_hours?branch_id=12&from_date=2024-03-25&to_date=2024-03-31",
"method": "GET"
},
"response": {
"status": 200,
"body": "[\n {\n \"id\": 3,\n \"category\": {\n \"title\": \"Åbent\",\n \"color\": \"#4986e7\"\n },\n \"date\": \"2024-03-25\",\n \"start_time\": \"08:00\",\n \"end_time\": \"16:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 1,\n \"type\": \"weekly\",\n \"weekly_data\": {\n \"end_date\": \"2024-04-14\"\n }\n }\n },\n {\n \"id\": 8,\n \"category\": {\n \"title\": \"Åbent\",\n \"color\": \"#4986e7\"\n },\n \"date\": \"2024-03-26\",\n \"start_time\": \"08:00\",\n \"end_time\": \"16:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 2,\n \"type\": \"weekly\",\n \"weekly_data\": {\n \"end_date\": \"2024-04-14\"\n }\n }\n },\n {\n \"id\": 28,\n \"category\": {\n \"title\": \"Telefon\",\n \"color\": \"green\"\n },\n \"date\": \"2024-03-26\",\n \"start_time\": \"10:00\",\n \"end_time\": \"13:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 6,\n \"type\": \"weekly\",\n \"weekly_data\": {\n \"end_date\": \"2024-04-14\"\n }\n }\n },\n {\n \"id\": 13,\n \"category\": {\n \"title\": \"Åbent\",\n \"color\": \"#4986e7\"\n },\n \"date\": \"2024-03-27\",\n \"start_time\": \"08:00\",\n \"end_time\": \"14:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 3,\n \"type\": \"weekly\",\n \"weekly_data\": {\n \"end_date\": \"2024-04-14\"\n }\n }\n },\n {\n \"id\": 18,\n \"category\": {\n \"title\": \"Åbent\",\n \"color\": \"#4986e7\"\n },\n \"date\": \"2024-03-28\",\n \"start_time\": \"08:00\",\n \"end_time\": \"16:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 4,\n \"type\": \"weekly\",\n \"weekly_data\": {\n \"end_date\": \"2024-04-14\"\n }\n }\n },\n {\n \"id\": 23,\n \"category\": {\n \"title\": \"Åbent\",\n \"color\": \"#4986e7\"\n },\n \"date\": \"2024-03-29\",\n \"start_time\": \"08:00\",\n \"end_time\": \"12:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 5,\n \"type\": \"weekly\",\n \"weekly_data\": {\n \"end_date\": \"2024-04-14\"\n }\n }\n },\n {\n \"id\": 33,\n \"category\": {\n \"title\": \"Borgerservice\",\n \"color\": \"lightblue\"\n },\n \"date\": \"2024-03-30\",\n \"start_time\": \"08:00\",\n \"end_time\": \"11:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 8,\n \"type\": \"none\"\n }\n }\n]",
"headers": {
"Content-Type": "application/json"
}
},
"uuid": "b03cdd7c-c1e0-4e35-b374-f429642e379f",
"persistent": true,
"priority": 5,
"insertionIndex": 3,
"postServeActions": []
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "f52a1b96-38d2-479a-aeaf-65367637d365",
"name": "Delete event",
"id": "b4a3d509-efc1-409b-acfd-4eaad6d6c6e2",
"name": "Opening hours delete instance",
"request": {
"urlPathPattern": "/dpl_opening_hours/[0-9]+",
"method": "DELETE"
Expand All @@ -10,9 +10,9 @@
"body": "",
"headers": {}
},
"uuid": "f52a1b96-38d2-479a-aeaf-65367637d365",
"uuid": "b4a3d509-efc1-409b-acfd-4eaad6d6c6e2",
"persistent": true,
"priority": 5,
"insertionIndex": 1,
"insertionIndex": 5,
"postServeActions": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"id": "104eae1e-ae10-4893-aadb-7f19ca988f1a",
"name": "Opening hours next week",
"request": {
"url": "/dpl_opening_hours?branch_id=12&from_date=2024-04-01&to_date=2024-04-07",
"method": "GET"
},
"response": {
"status": 200,
"body": "[\n {\n \"id\": 4,\n \"category\": {\n \"title\": \"Åbent\",\n \"color\": \"#4986e7\"\n },\n \"date\": \"2024-04-01\",\n \"start_time\": \"08:00\",\n \"end_time\": \"16:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 1,\n \"type\": \"weekly\",\n \"weekly_data\": {\n \"end_date\": \"2024-04-14\"\n }\n }\n },\n {\n \"id\": 9,\n \"category\": {\n \"title\": \"Åbent\",\n \"color\": \"#4986e7\"\n },\n \"date\": \"2024-04-02\",\n \"start_time\": \"08:00\",\n \"end_time\": \"16:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 2,\n \"type\": \"weekly\",\n \"weekly_data\": {\n \"end_date\": \"2024-04-14\"\n }\n }\n },\n {\n \"id\": 29,\n \"category\": {\n \"title\": \"Telefon\",\n \"color\": \"green\"\n },\n \"date\": \"2024-04-02\",\n \"start_time\": \"10:00\",\n \"end_time\": \"13:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 6,\n \"type\": \"weekly\",\n \"weekly_data\": {\n \"end_date\": \"2024-04-14\"\n }\n }\n },\n {\n \"id\": 14,\n \"category\": {\n \"title\": \"Åbent\",\n \"color\": \"#4986e7\"\n },\n \"date\": \"2024-04-03\",\n \"start_time\": \"08:00\",\n \"end_time\": \"14:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 3,\n \"type\": \"weekly\",\n \"weekly_data\": {\n \"end_date\": \"2024-04-14\"\n }\n }\n },\n {\n \"id\": 19,\n \"category\": {\n \"title\": \"Åbent\",\n \"color\": \"#4986e7\"\n },\n \"date\": \"2024-04-04\",\n \"start_time\": \"08:00\",\n \"end_time\": \"16:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 4,\n \"type\": \"weekly\",\n \"weekly_data\": {\n \"end_date\": \"2024-04-14\"\n }\n }\n },\n {\n \"id\": 24,\n \"category\": {\n \"title\": \"Åbent\",\n \"color\": \"#4986e7\"\n },\n \"date\": \"2024-04-05\",\n \"start_time\": \"08:00\",\n \"end_time\": \"12:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 5,\n \"type\": \"weekly\",\n \"weekly_data\": {\n \"end_date\": \"2024-04-14\"\n }\n }\n },\n {\n \"id\": 34,\n \"category\": {\n \"title\": \"Borgerservice\",\n \"color\": \"lightblue\"\n },\n \"date\": \"2024-04-04\",\n \"start_time\": \"08:00\",\n \"end_time\": \"11:00\",\n \"branch_id\": 12,\n \"repetition\": {\n \"id\": 9,\n \"type\": \"none\"\n }\n }\n]",
"headers": {
"Content-Type": "application/json"
}
},
"uuid": "104eae1e-ae10-4893-aadb-7f19ca988f1a",
"persistent": true,
"priority": 5,
"insertionIndex": 4,
"postServeActions": []
}
Loading

0 comments on commit 0242b8b

Please sign in to comment.