Skip to content

Commit 93b1471

Browse files
committed
added mock api adn basic authentication script
1 parent 5eb5d2a commit 93b1471

10 files changed

Lines changed: 609 additions & 6 deletions

data/db.json

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
{
2+
"brands": [
3+
{
4+
"id": "01J47796Q8XWWJ66Z4MX764YKS",
5+
"name": "Hand Tools",
6+
"slug": "hand-tools",
7+
"parent_id": null,
8+
"sub_categories": [
9+
{
10+
"id": "01J47796QCFV3FS7SEKFF51VD1",
11+
"name": "Hammer",
12+
"slug": "hammer",
13+
"parent_id": "01J47796Q8XWWJ66Z4MX764YKS",
14+
"sub_categories": []
15+
},
16+
{
17+
"id": "01J47796QCFV3FS7SEKFF51VD2",
18+
"name": "Hand Saw",
19+
"slug": "hand-saw",
20+
"parent_id": "01J47796Q8XWWJ66Z4MX764YKS",
21+
"sub_categories": []
22+
},
23+
{
24+
"id": "01J47796QCFV3FS7SEKFF51VD3",
25+
"name": "Wrench",
26+
"slug": "wrench",
27+
"parent_id": "01J47796Q8XWWJ66Z4MX764YKS",
28+
"sub_categories": []
29+
},
30+
{
31+
"id": "01J47796QCFV3FS7SEKFF51VD4",
32+
"name": "Screwdriver",
33+
"slug": "screwdriver",
34+
"parent_id": "01J47796Q8XWWJ66Z4MX764YKS",
35+
"sub_categories": []
36+
},
37+
{
38+
"id": "01J47796QCFV3FS7SEKFF51VD5",
39+
"name": "Pliers",
40+
"slug": "pliers",
41+
"parent_id": "01J47796Q8XWWJ66Z4MX764YKS",
42+
"sub_categories": []
43+
},
44+
{
45+
"id": "01J47796QCFV3FS7SEKFF51VD6",
46+
"name": "Chisels",
47+
"slug": "chisels",
48+
"parent_id": "01J47796Q8XWWJ66Z4MX764YKS",
49+
"sub_categories": []
50+
},
51+
{
52+
"id": "01J47796QCFV3FS7SEKFF51VD7",
53+
"name": "Glass",
54+
"slug": "Glass",
55+
"parent_id": "01J47796Q8XWWJ66Z4MX764YKS",
56+
"sub_categories": []
57+
}
58+
]
59+
}
60+
],
61+
"mobiles": [
62+
{
63+
"id": 1,
64+
"name": "Google Pixel 6 Pro",
65+
"data": {
66+
"color": "Cloudy White",
67+
"capacity": "128 GB"
68+
},
69+
"reviewId": 1
70+
},
71+
{
72+
"id": 2,
73+
"name": "Apple iPhone 12 Mini, 256GB, Blue",
74+
"data": null,
75+
"reviewId": 2
76+
},
77+
{
78+
"id": 3,
79+
"name": "Apple iPhone 12 Pro Max",
80+
"data": {
81+
"color": "Cloudy White",
82+
"capacity GB": 512
83+
},
84+
"reviewId": 3
85+
},
86+
{
87+
"id": 4,
88+
"name": "Apple iPhone 11, 64GB",
89+
"data": {
90+
"price": 389.99,
91+
"color": "Purple"
92+
}
93+
},
94+
{
95+
"id": 5,
96+
"name": "Samsung Galaxy Z Fold2",
97+
"data": {
98+
"price": 689.99,
99+
"color": "Brown"
100+
}
101+
},
102+
{
103+
"id": 6,
104+
"name": "Apple AirPods",
105+
"data": {
106+
"generation": "3rd",
107+
"price": 120
108+
}
109+
},
110+
{
111+
"id": 7,
112+
"name": "Apple MacBook Pro 16",
113+
"data": {
114+
"year": 2019,
115+
"price": 1849.99,
116+
"CPU model": "Intel Core i9",
117+
"Hard disk size": "1 TB"
118+
}
119+
},
120+
{
121+
"id": 8,
122+
"name": "Apple Watch Series 8",
123+
"data": {
124+
"Strap Colour": "Elderberry",
125+
"Case Size": "41mm"
126+
}
127+
},
128+
{
129+
"id": 9,
130+
"name": "Beats Studio3 Wireless",
131+
"data": {
132+
"Color": "Red",
133+
"Description": "High-performance wireless noise cancelling headphones"
134+
}
135+
},
136+
{
137+
"id": 10,
138+
"name": "Apple iPad Mini 5th Gen",
139+
"data": {
140+
"Capacity": "64 GB",
141+
"Screen size": 7.9
142+
}
143+
},
144+
{
145+
"id": 11,
146+
"name": "Apple iPad Mini 5th Gen",
147+
"data": {
148+
"Capacity": "254 GB",
149+
"Screen size": 7.9
150+
}
151+
},
152+
{
153+
"id": 12,
154+
"name": "Apple iPad Air",
155+
"data": {
156+
"Generation": "4th",
157+
"Price": "419.99",
158+
"Capacity": "64 GB"
159+
}
160+
},
161+
{
162+
"id": 13,
163+
"name": "Apple iPad Air",
164+
"data": {
165+
"Generation": "4th",
166+
"Price": "519.99",
167+
"Capacity": "256 GB"
168+
}
169+
},
170+
{
171+
"data": {
172+
"color": "Cloudy White",
173+
"capacity": "128 GB",
174+
"price": "500"
175+
},
176+
"reviewId": 5,
177+
"id": 20
178+
}
179+
],
180+
"reviews": [
181+
{
182+
"id": 1,
183+
"rating": 3,
184+
"comment": "Mobile camera have good resolution",
185+
"mobileId": 1
186+
},
187+
{
188+
"id": 2,
189+
"rating": 4,
190+
"comment": "Battery life is good",
191+
"mobileId": 1
192+
},
193+
{
194+
"id": 3,
195+
"rating": 3,
196+
"comment": "Price is too high",
197+
"mobileId": 2
198+
},
199+
{
200+
"id": 4,
201+
"rating": 5,
202+
"comment": "Lot of new apps....",
203+
"mobileId": 3
204+
}
205+
]
206+
}

data/routes.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"/api/*": "/$1",
3+
"/mobiles/:name": "/mobiles?name_like=:name",
4+
"/reviews/:id": "/reviews?id=:id"
5+
}

logs/combined.log

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,3 +403,23 @@
403403
{"level":"info","message":"info","meta":"Test Suite Started : , 1 tests","service":"job-posting-service","timestamp":"2025-10-04T17:25:37.750Z"}
404404
{"level":"info","message":"info","meta":"Test Case Started : Check the exception and logs in console log","service":"job-posting-service","timestamp":"2025-10-04T17:25:42.200Z"}
405405
{"level":"info","message":"info","meta":"Test Case Completed : Check the exception and logs in console log Status : passed","service":"job-posting-service","timestamp":"2025-10-04T17:26:57.039Z"}
406+
{"level":"info","message":"playwright-framework-template undefined","service":"job-posting-service","timestamp":"2025-10-05T11:01:13.088Z"}
407+
{"level":"info","message":"info","meta":"Test Suite Started : , 1 tests","service":"job-posting-service","timestamp":"2025-10-05T11:01:21.972Z"}
408+
{"level":"info","message":"info","meta":"Test Case Started : Validate category with subcategoty","service":"job-posting-service","timestamp":"2025-10-05T11:01:30.704Z"}
409+
{"level":"info","message":"info","meta":"Test Case Completed : Validate category with subcategoty Status : interrupted","service":"job-posting-service","timestamp":"2025-10-05T11:03:21.444Z"}
410+
{"level":"info","message":"playwright-framework-template undefined","service":"job-posting-service","timestamp":"2025-10-05T11:03:33.405Z"}
411+
{"level":"info","message":"info","meta":"Test Suite Started : , 1 tests","service":"job-posting-service","timestamp":"2025-10-05T11:03:40.976Z"}
412+
{"level":"info","message":"info","meta":"Test Case Started : Validate category with subcategoty","service":"job-posting-service","timestamp":"2025-10-05T11:03:59.801Z"}
413+
{"level":"info","message":"info","meta":"Test Case Completed : Validate category with subcategoty Status : timedOut","service":"job-posting-service","timestamp":"2025-10-05T11:07:11.911Z"}
414+
{"level":"info","message":"info","meta":"Test Case Started : Validate category with subcategoty","service":"job-posting-service","timestamp":"2025-10-05T11:07:23.454Z"}
415+
{"level":"info","message":"info","meta":"Test Case Completed : Validate category with subcategoty Status : timedOut","service":"job-posting-service","timestamp":"2025-10-05T11:11:12.808Z"}
416+
{"level":"info","message":"info","meta":"Test Case Started : Validate category with subcategoty","service":"job-posting-service","timestamp":"2025-10-05T14:16:12.202Z"}
417+
{"level":"info","message":"info","meta":"Test Case Completed : Validate category with subcategoty Status : interrupted","service":"job-posting-service","timestamp":"2025-10-05T14:16:16.468Z"}
418+
{"level":"info","message":"playwright-framework-template undefined","service":"job-posting-service","timestamp":"2025-10-05T14:19:34.709Z"}
419+
{"level":"info","message":"info","meta":"Test Suite Started : , 1 tests","service":"job-posting-service","timestamp":"2025-10-05T14:19:35.153Z"}
420+
{"level":"info","message":"info","meta":"Test Case Started : Basic Authetication","service":"job-posting-service","timestamp":"2025-10-05T14:19:39.006Z"}
421+
{"level":"info","message":"info","meta":"Test Case Completed : Basic Authetication Status : passed","service":"job-posting-service","timestamp":"2025-10-05T14:20:30.514Z"}
422+
{"level":"info","message":"playwright-framework-template undefined","service":"job-posting-service","timestamp":"2025-10-05T14:23:21.325Z"}
423+
{"level":"info","message":"info","meta":"Test Suite Started : , 1 tests","service":"job-posting-service","timestamp":"2025-10-05T14:23:21.792Z"}
424+
{"level":"info","message":"info","meta":"Test Case Started : Basic Authetication with Extra HTTP headers","service":"job-posting-service","timestamp":"2025-10-05T14:23:26.454Z"}
425+
{"level":"info","message":"info","meta":"Test Case Completed : Basic Authetication with Extra HTTP headers Status : passed","service":"job-posting-service","timestamp":"2025-10-05T14:23:38.241Z"}

middleware.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = (req, res, next) => {
2+
res.header('X-Hello', 'World')
3+
next()
4+
}

0 commit comments

Comments
 (0)