Skip to content

Commit 55eb3f3

Browse files
committed
resync spec tests
1 parent 6872730 commit 55eb3f3

File tree

2 files changed

+61
-34
lines changed

2 files changed

+61
-34
lines changed

test/unified-test-format/valid-fail/operator-matchAsDocument.json

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@
3333
},
3434
{
3535
"_id": 2,
36+
"json": "1"
37+
},
38+
{
39+
"_id": 3,
40+
"json": "[ \"foo\" ]"
41+
},
42+
{
43+
"_id": 4,
3644
"json": "{ \"x\" }"
3745
}
3846
]
@@ -119,7 +127,7 @@
119127
]
120128
},
121129
{
122-
"description": "matchAsDocument fails to decode Extended JSON",
130+
"description": "matchAsDocument expects JSON object but given scalar",
123131
"operations": [
124132
{
125133
"name": "find",
@@ -135,7 +143,57 @@
135143
"_id": 2,
136144
"json": {
137145
"$$matchAsDocument": {
138-
"x": 1
146+
"$$matchAsRoot": {}
147+
}
148+
}
149+
}
150+
]
151+
}
152+
]
153+
},
154+
{
155+
"description": "matchAsDocument expects JSON object but given array",
156+
"operations": [
157+
{
158+
"name": "find",
159+
"object": "collection0",
160+
"arguments": {
161+
"filter": {
162+
"_id": 3
163+
},
164+
"limit": 1
165+
},
166+
"expectResult": [
167+
{
168+
"_id": 3,
169+
"json": {
170+
"$$matchAsDocument": {
171+
"$$matchAsRoot": {}
172+
}
173+
}
174+
}
175+
]
176+
}
177+
]
178+
},
179+
{
180+
"description": "matchAsDocument fails to decode Extended JSON",
181+
"operations": [
182+
{
183+
"name": "find",
184+
"object": "collection0",
185+
"arguments": {
186+
"filter": {
187+
"_id": 4
188+
},
189+
"limit": 1
190+
},
191+
"expectResult": [
192+
{
193+
"_id": 4,
194+
"json": {
195+
"$$matchAsDocument": {
196+
"$$matchAsRoot": {}
139197
}
140198
}
141199
}

test/unified-test-format/valid-fail/operator-matchAsRoot.json

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,13 @@
3333
"y": 2,
3434
"z": 3
3535
}
36-
},
37-
{
38-
"_id": 2,
39-
"x": "{ \"x\": 1, \"y\": 2.0 }"
4036
}
4137
]
4238
}
4339
],
4440
"tests": [
4541
{
46-
"description": "matchAsRoot with nested document",
42+
"description": "matchAsRoot with nested document does not match",
4743
"operations": [
4844
{
4945
"name": "find",
@@ -66,33 +62,6 @@
6662
]
6763
}
6864
]
69-
},
70-
{
71-
"description": "matchAsRoot with matchAsDocument",
72-
"operations": [
73-
{
74-
"name": "find",
75-
"object": "collection0",
76-
"arguments": {
77-
"filter": {
78-
"_id": 1
79-
},
80-
"limit": 1
81-
},
82-
"expectResult": [
83-
{
84-
"_id": 2,
85-
"x": {
86-
"$$matchAsDocument": {
87-
"$$matchAsRoot": {
88-
"x": 1
89-
}
90-
}
91-
}
92-
}
93-
]
94-
}
95-
]
9665
}
9766
]
9867
}

0 commit comments

Comments
 (0)