Skip to content

Commit a44b3f8

Browse files
authored
Merge pull request #27 from keploy/shivam/jest
feat:jest support
2 parents ff000e1 + 69fe186 commit a44b3f8

File tree

12 files changed

+6675
-405
lines changed

12 files changed

+6675
-405
lines changed

express-mongoose/jest.config.js

Whitespace-only changes.
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
version: api.keploy.io/v1beta2
2+
kind: Mongo
3+
name: mocks
4+
spec:
5+
metadata:
6+
operation: '{ OpQuery flags: [], fullCollectionName: admin.$cmd, numberToSkip: 0, numberToReturn: -1, query: {"ismaster": {"$numberInt":"1"},"helloOk": true,"client": {"driver": {"name": "nodejs|Mongoose","version": "5.8.1|7.5.3"},"platform": "Node.js v21.1.0, LE","os": {"name": "linux","architecture": "arm64","version": "6.1.0-13-cloud-arm64","type": "Linux"}},"compression": ["none"]}, returnFieldsSelector: }'
7+
type: config
8+
requests:
9+
- header:
10+
length: 308
11+
requestId: 1
12+
responseTo: 0
13+
Opcode: 2004
14+
message:
15+
flags: 0
16+
collection_name: admin.$cmd
17+
number_to_skip: 0
18+
number_to_return: -1
19+
query: '{"ismaster":{"$numberInt":"1"},"helloOk":true,"client":{"driver":{"name":"nodejs|Mongoose","version":"5.8.1|7.5.3"},"platform":"Node.js v21.1.0, LE","os":{"name":"linux","architecture":"arm64","version":"6.1.0-13-cloud-arm64","type":"Linux"}},"compression":["none"]}'
20+
return_fields_selector: ""
21+
read_delay: 29249
22+
responses:
23+
- header:
24+
length: 329
25+
requestId: 2962
26+
responseTo: 1
27+
Opcode: 1
28+
message:
29+
response_flags: 8
30+
cursor_id: 0
31+
starting_from: 0
32+
number_returned: 1
33+
documents:
34+
- '{"helloOk":true,"ismaster":true,"topologyVersion":{"processId":{"$oid":"65461a561e48b5db78ec73b9"},"counter":{"$numberLong":"0"}},"maxBsonObjectSize":{"$numberInt":"16777216"},"maxMessageSizeBytes":{"$numberInt":"48000000"},"maxWriteBatchSize":{"$numberInt":"100000"},"localTime":{"$date":{"$numberLong":"1699102502316"}},"logicalSessionTimeoutMinutes":{"$numberInt":"30"},"connectionId":{"$numberInt":"190"},"minWireVersion":{"$numberInt":"0"},"maxWireVersion":{"$numberInt":"21"},"readOnly":false,"ok":{"$numberDouble":"1.0"}}'
35+
read_delay: 1744425
36+
created: 1699102502
37+
reqTimestampMock: 2023-11-04T12:55:02.314583807Z
38+
resTimestampMock: 2023-11-04T12:55:02.316600019Z
39+
---
40+
version: api.keploy.io/v1beta2
41+
kind: Mongo
42+
name: mocks
43+
spec:
44+
metadata:
45+
operation: '{ OpMsg flags: 0, sections: [{ SectionSingle msg: {"create":"students","lsid":{"id":{"$binary":{"base64":"T0oPnqkZQCyzQAEiUYqOfA==","subType":"04"}}},"$db":"Students"} }], checksum: 0 }'
46+
requests:
47+
- header:
48+
length: 101
49+
requestId: 3
50+
responseTo: 0
51+
Opcode: 2013
52+
message:
53+
flagBits: 0
54+
sections:
55+
- '{ SectionSingle msg: {"create":"students","lsid":{"id":{"$binary":{"base64":"T0oPnqkZQCyzQAEiUYqOfA==","subType":"04"}}},"$db":"Students"} }'
56+
checksum: 0
57+
read_delay: 1381432
58+
responses:
59+
- header:
60+
length: 38
61+
requestId: 2964
62+
responseTo: 3
63+
Opcode: 2013
64+
message:
65+
flagBits: 0
66+
sections:
67+
- '{ SectionSingle msg: {"ok":{"$numberDouble":"1.0"}} }'
68+
checksum: 0
69+
read_delay: 550489
70+
created: 1699102502
71+
reqTimestampMock: 2023-11-04T12:55:02.328051469Z
72+
resTimestampMock: 2023-11-04T12:55:02.330174596Z
73+
---
74+
version: api.keploy.io/v1beta2
75+
kind: Mongo
76+
name: mocks
77+
spec:
78+
metadata:
79+
operation: '{ OpMsg flags: 0, sections: [{ SectionSingle msg: {"createIndexes":"students","indexes":[{"unique":true,"background":true,"name":"email_1","key":{"email":{"$numberInt":"1"}}}],"lsid":{"id":{"$binary":{"base64":"T0oPnqkZQCyzQAEiUYqOfA==","subType":"04"}}},"$db":"Students"} }], checksum: 0 }'
80+
requests:
81+
- header:
82+
length: 191
83+
requestId: 4
84+
responseTo: 0
85+
Opcode: 2013
86+
message:
87+
flagBits: 0
88+
sections:
89+
- '{ SectionSingle msg: {"createIndexes":"students","indexes":[{"unique":true,"background":true,"name":"email_1","key":{"email":{"$numberInt":"1"}}}],"lsid":{"id":{"$binary":{"base64":"T0oPnqkZQCyzQAEiUYqOfA==","subType":"04"}}},"$db":"Students"} }'
90+
checksum: 0
91+
read_delay: 2435454
92+
responses:
93+
- header:
94+
length: 117
95+
requestId: 2965
96+
responseTo: 4
97+
Opcode: 2013
98+
message:
99+
flagBits: 0
100+
sections:
101+
- '{ SectionSingle msg: {"numIndexesBefore":{"$numberInt":"3"},"numIndexesAfter":{"$numberInt":"3"},"note":"all indexes already exist","ok":{"$numberDouble":"1.0"}} }'
102+
checksum: 0
103+
read_delay: 493907
104+
created: 1699102502
105+
reqTimestampMock: 2023-11-04T12:55:02.331133411Z
106+
resTimestampMock: 2023-11-04T12:55:02.331807232Z
107+
---
108+
version: api.keploy.io/v1beta2
109+
kind: Mongo
110+
name: mocks
111+
spec:
112+
metadata:
113+
operation: '{ OpMsg flags: 0, sections: [{ SectionSingle msg: {"createIndexes":"students","indexes":[{"unique":true,"background":true,"name":"phone_1","key":{"phone":{"$numberInt":"1"}}}],"lsid":{"id":{"$binary":{"base64":"T0oPnqkZQCyzQAEiUYqOfA==","subType":"04"}}},"$db":"Students"} }], checksum: 0 }'
114+
requests:
115+
- header:
116+
length: 191
117+
requestId: 5
118+
responseTo: 0
119+
Opcode: 2013
120+
message:
121+
flagBits: 0
122+
sections:
123+
- '{ SectionSingle msg: {"createIndexes":"students","indexes":[{"unique":true,"background":true,"name":"phone_1","key":{"phone":{"$numberInt":"1"}}}],"lsid":{"id":{"$binary":{"base64":"T0oPnqkZQCyzQAEiUYqOfA==","subType":"04"}}},"$db":"Students"} }'
124+
checksum: 0
125+
read_delay: 821359
126+
responses:
127+
- header:
128+
length: 117
129+
requestId: 2966
130+
responseTo: 5
131+
Opcode: 2013
132+
message:
133+
flagBits: 0
134+
sections:
135+
- '{ SectionSingle msg: {"numIndexesBefore":{"$numberInt":"3"},"numIndexesAfter":{"$numberInt":"3"},"note":"all indexes already exist","ok":{"$numberDouble":"1.0"}} }'
136+
checksum: 0
137+
read_delay: 392534
138+
created: 1699102502
139+
reqTimestampMock: 2023-11-04T12:55:02.332689465Z
140+
resTimestampMock: 2023-11-04T12:55:02.333183664Z
141+
---
142+
version: api.keploy.io/v1beta2
143+
kind: Mongo
144+
name: mocks
145+
spec:
146+
metadata:
147+
operation: '{ OpMsg flags: 65536, sections: [{ SectionSingle msg: {"hello":{"$numberInt":"1"},"maxAwaitTimeMS":{"$numberInt":"10000"},"topologyVersion":{"processId":{"$oid":"65461a561e48b5db78ec73b9"},"counter":{"$numberLong":"0"}},"$db":"admin"} }], checksum: 0 }'
148+
type: config
149+
requests:
150+
- header:
151+
length: 134
152+
requestId: 6
153+
responseTo: 0
154+
Opcode: 2013
155+
message:
156+
flagBits: 65536
157+
sections:
158+
- '{ SectionSingle msg: {"hello":{"$numberInt":"1"},"maxAwaitTimeMS":{"$numberInt":"10000"},"topologyVersion":{"processId":{"$oid":"65461a561e48b5db78ec73b9"},"counter":{"$numberLong":"0"}},"$db":"admin"} }'
159+
checksum: 0
160+
read_delay: 508154798
161+
responses:
162+
- header:
163+
length: 313
164+
requestId: 2971
165+
responseTo: 6
166+
Opcode: 2013
167+
message:
168+
flagBits: 2
169+
sections:
170+
- '{ SectionSingle msg: {"isWritablePrimary":true,"topologyVersion":{"processId":{"$oid":"65461a561e48b5db78ec73b9"},"counter":{"$numberLong":"0"}},"maxBsonObjectSize":{"$numberInt":"16777216"},"maxMessageSizeBytes":{"$numberInt":"48000000"},"maxWriteBatchSize":{"$numberInt":"100000"},"localTime":{"$date":{"$numberLong":"1699102512828"}},"logicalSessionTimeoutMinutes":{"$numberInt":"30"},"connectionId":{"$numberInt":"190"},"minWireVersion":{"$numberInt":"0"},"maxWireVersion":{"$numberInt":"21"},"readOnly":false,"ok":{"$numberDouble":"1.0"}} }'
171+
checksum: 0
172+
read_delay: 10004482269
173+
created: 1699102512
174+
reqTimestampMock: 2023-11-04T12:55:02.82487669Z
175+
resTimestampMock: 2023-11-04T12:55:12.829832116Z
176+
---
177+
version: api.keploy.io/v1beta2
178+
kind: Mongo
179+
name: mocks
180+
spec:
181+
metadata:
182+
operation: '{ OpMsg flags: 0, sections: [{ SectionSingle msg: {"find":"students","filter":{},"lsid":{"id":{"$binary":{"base64":"T0oPnqkZQCyzQAEiUYqOfA==","subType":"04"}}},"$db":"Students"} }], checksum: 0 }'
183+
requests:
184+
- header:
185+
length: 112
186+
requestId: 8
187+
responseTo: 0
188+
Opcode: 2013
189+
message:
190+
flagBits: 0
191+
sections:
192+
- '{ SectionSingle msg: {"find":"students","filter":{},"lsid":{"id":{"$binary":{"base64":"T0oPnqkZQCyzQAEiUYqOfA==","subType":"04"}}},"$db":"Students"} }'
193+
checksum: 0
194+
read_delay: 16678358888
195+
responses:
196+
- header:
197+
length: 557
198+
requestId: 2973
199+
responseTo: 8
200+
Opcode: 2013
201+
message:
202+
flagBits: 0
203+
sections:
204+
- '{ SectionSingle msg: {"cursor":{"firstBatch":[{"_id":{"$oid":"65449f16e7cbcd56ac7ef571"},"name":"John Doe","email":"john@xyz.com","phone":{"$numberInt":"123456798"},"__v":{"$numberInt":"0"}},{"_id":{"$oid":"654528488029ad5fe4d8b14c"},"name":"John Doe","email":"john@xyzw.com","phone":{"$numberDouble":"3.0123456798E+10"},"__v":{"$numberInt":"0"}},{"_id":{"$oid":"6546361d19db8f749f391d79"},"name":"John Doe","email":"jodhn@xyz.com","phone":{"$numberInt":"1263456798"},"__v":{"$numberInt":"0"}},{"_id":{"$oid":"654636c8af93e55ea077a39d"},"name":"John Doe","email":"joddhn@xyz.com","phone":{"$numberInt":"1203456798"},"__v":{"$numberInt":"0"}},{"_id":{"$oid":"654636f209fb119d87e76781"},"name":"John Doe","email":"joddhwn@xyz.com","phone":{"$numberInt":"1203456799"},"__v":{"$numberInt":"0"}}],"id":{"$numberLong":"0"},"ns":"Students.students"},"ok":{"$numberDouble":"1.0"}} }'
205+
checksum: 0
206+
read_delay: 4685495
207+
created: 1699102519
208+
reqTimestampMock: 2023-11-04T12:55:19.011583677Z
209+
resTimestampMock: 2023-11-04T12:55:19.016455668Z
210+
---
211+
version: api.keploy.io/v1beta2
212+
kind: Mongo
213+
name: mocks
214+
spec:
215+
metadata:
216+
operation: '{ OpMsg flags: 0, sections: [{ SectionSingle msg: {"ismaster":{"$numberInt":"1"},"$db":"admin"} }], checksum: 0 }'
217+
requests:
218+
- header:
219+
length: 55
220+
requestId: 9
221+
responseTo: 0
222+
Opcode: 2013
223+
message:
224+
flagBits: 0
225+
sections:
226+
- '{ SectionSingle msg: {"ismaster":{"$numberInt":"1"},"$db":"admin"} }'
227+
checksum: 0
228+
read_delay: 10005486176
229+
responses:
230+
- header:
231+
length: 304
232+
requestId: 2979
233+
responseTo: 9
234+
Opcode: 2013
235+
message:
236+
flagBits: 0
237+
sections:
238+
- '{ SectionSingle msg: {"ismaster":true,"topologyVersion":{"processId":{"$oid":"65461a561e48b5db78ec73b9"},"counter":{"$numberLong":"0"}},"maxBsonObjectSize":{"$numberInt":"16777216"},"maxMessageSizeBytes":{"$numberInt":"48000000"},"maxWriteBatchSize":{"$numberInt":"100000"},"localTime":{"$date":{"$numberLong":"1699102522840"}},"logicalSessionTimeoutMinutes":{"$numberInt":"30"},"connectionId":{"$numberInt":"192"},"minWireVersion":{"$numberInt":"0"},"maxWireVersion":{"$numberInt":"21"},"readOnly":false,"ok":{"$numberDouble":"1.0"}} }'
239+
checksum: 0
240+
read_delay: 333244
241+
created: 1699102522
242+
reqTimestampMock: 2023-11-04T12:55:22.840253157Z
243+
resTimestampMock: 2023-11-04T12:55:22.840779314Z
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: api.keploy.io/v1beta2
2+
kind: Http
3+
name: test-1
4+
spec:
5+
metadata: {}
6+
req:
7+
method: GET
8+
proto_major: 1
9+
proto_minor: 1
10+
url: http://localhost:8000/students
11+
header:
12+
Accept: '*/*'
13+
Host: localhost:8000
14+
User-Agent: curl/7.88.1
15+
body: ""
16+
body_type: ""
17+
timestamp: 2023-11-04T12:55:19.00702043Z
18+
resp:
19+
status_code: 200
20+
header:
21+
Connection: keep-alive
22+
Content-Length: "523"
23+
Content-Type: application/json; charset=utf-8
24+
Date: Sat, 04 Nov 2023 12:55:19 GMT
25+
Etag: W/"20b-wEHDTOeND1Hgnd4o9ajDsn/Qwlg"
26+
Keep-Alive: timeout=5
27+
X-Powered-By: Express
28+
body: '[{"_id":"65449f16e7cbcd56ac7ef571","name":"John Doe","email":"john@xyz.com","phone":123456798,"__v":0},{"_id":"654528488029ad5fe4d8b14c","name":"John Doe","email":"john@xyzw.com","phone":30123456798,"__v":0},{"_id":"6546361d19db8f749f391d79","name":"John Doe","email":"jodhn@xyz.com","phone":1263456798,"__v":0},{"_id":"654636c8af93e55ea077a39d","name":"John Doe","email":"joddhn@xyz.com","phone":1203456798,"__v":0},{"_id":"654636f209fb119d87e76781","name":"John Doe","email":"joddhwn@xyz.com","phone":1203456799,"__v":0}]'
29+
body_type: ""
30+
status_message: ""
31+
proto_major: 0
32+
proto_minor: 0
33+
timestamp: 2023-11-04T12:55:21.48575217Z
34+
objects: []
35+
assertions:
36+
noise:
37+
- header.Date
38+
created: 1699102521
39+
curl: |
40+
curl --request GET \
41+
--url http://localhost:8000/students \
42+
--header 'Host: localhost:8000' \
43+
--header 'User-Agent: curl/7.88.1' \
44+
--header 'Accept: */*' \

0 commit comments

Comments
 (0)