@@ -4,16 +4,8 @@ import { configContext, resetConfigContext, updateConfigContext } from "../Confi
4
4
import { DatabaseAccount } from "../Contracts/DataModels" ;
5
5
import { Collection } from "../Contracts/ViewModels" ;
6
6
import DocumentId from "../Explorer/Tree/DocumentId" ;
7
- import { extractFeatures } from "../Platform/Hosted/extractFeatures" ;
8
7
import { updateUserContext } from "../UserContext" ;
9
- import {
10
- deleteDocument ,
11
- getEndpoint ,
12
- getFeatureEndpointOrDefault ,
13
- queryDocuments ,
14
- readDocument ,
15
- updateDocument ,
16
- } from "./MongoProxyClient" ;
8
+ import { deleteDocuments , getEndpoint , queryDocuments , readDocument , updateDocument } from "./MongoProxyClient" ;
17
9
18
10
const databaseId = "testDB" ;
19
11
@@ -196,20 +188,8 @@ describe("MongoProxyClient", () => {
196
188
expect . any ( Object ) ,
197
189
) ;
198
190
} ) ;
199
-
200
- it ( "builds the correct proxy URL in development" , ( ) => {
201
- updateConfigContext ( {
202
- MONGO_BACKEND_ENDPOINT : "https://localhost:1234" ,
203
- globallyEnabledMongoAPIs : [ ] ,
204
- } ) ;
205
- updateDocument ( databaseId , collection , documentId , "{}" ) ;
206
- expect ( window . fetch ) . toHaveBeenCalledWith (
207
- `${ configContext . MONGO_PROXY_ENDPOINT } /api/mongo/explorer` ,
208
- expect . any ( Object ) ,
209
- ) ;
210
- } ) ;
211
191
} ) ;
212
- describe ( "deleteDocument " , ( ) => {
192
+ describe ( "deleteDocuments " , ( ) => {
213
193
beforeEach ( ( ) => {
214
194
resetConfigContext ( ) ;
215
195
updateUserContext ( {
@@ -226,9 +206,9 @@ describe("MongoProxyClient", () => {
226
206
} ) ;
227
207
228
208
it ( "builds the correct URL" , ( ) => {
229
- deleteDocument ( databaseId , collection , documentId ) ;
209
+ deleteDocuments ( databaseId , collection , [ documentId ] ) ;
230
210
expect ( window . fetch ) . toHaveBeenCalledWith (
231
- `${ configContext . MONGO_PROXY_ENDPOINT } /api/mongo/explorer` ,
211
+ `${ configContext . MONGO_PROXY_ENDPOINT } /api/mongo/explorer/bulkdelete ` ,
232
212
expect . any ( Object ) ,
233
213
) ;
234
214
} ) ;
@@ -238,9 +218,9 @@ describe("MongoProxyClient", () => {
238
218
MONGO_PROXY_ENDPOINT : "https://localhost:1234" ,
239
219
globallyEnabledMongoAPIs : [ ] ,
240
220
} ) ;
241
- deleteDocument ( databaseId , collection , documentId ) ;
221
+ deleteDocuments ( databaseId , collection , [ documentId ] ) ;
242
222
expect ( window . fetch ) . toHaveBeenCalledWith (
243
- `${ configContext . MONGO_PROXY_ENDPOINT } /api/mongo/explorer` ,
223
+ `${ configContext . MONGO_PROXY_ENDPOINT } /api/mongo/explorer/bulkdelete ` ,
244
224
expect . any ( Object ) ,
245
225
) ;
246
226
} ) ;
@@ -275,33 +255,4 @@ describe("MongoProxyClient", () => {
275
255
expect ( endpoint ) . toEqual ( `${ configContext . MONGO_PROXY_ENDPOINT } /api/connectionstring/mongo/explorer` ) ;
276
256
} ) ;
277
257
} ) ;
278
-
279
- describe ( "getFeatureEndpointOrDefault" , ( ) => {
280
- beforeEach ( ( ) => {
281
- resetConfigContext ( ) ;
282
- updateConfigContext ( {
283
- MONGO_PROXY_ENDPOINT : MongoProxyEndpoints . Prod ,
284
- globallyEnabledMongoAPIs : [ ] ,
285
- } ) ;
286
- const params = new URLSearchParams ( {
287
- "feature.mongoProxyEndpoint" : MongoProxyEndpoints . Prod ,
288
- "feature.mongoProxyAPIs" : "readDocument|createDocument" ,
289
- } ) ;
290
- const features = extractFeatures ( params ) ;
291
- updateUserContext ( {
292
- authType : AuthType . AAD ,
293
- features : features ,
294
- } ) ;
295
- } ) ;
296
-
297
- it ( "returns a local endpoint" , ( ) => {
298
- const endpoint = getFeatureEndpointOrDefault ( "readDocument" ) ;
299
- expect ( endpoint ) . toEqual ( `${ configContext . MONGO_PROXY_ENDPOINT } /api/mongo/explorer` ) ;
300
- } ) ;
301
-
302
- it ( "returns a production endpoint" , ( ) => {
303
- const endpoint = getFeatureEndpointOrDefault ( "DeleteDocument" ) ;
304
- expect ( endpoint ) . toEqual ( `${ configContext . MONGO_PROXY_ENDPOINT } /api/mongo/explorer` ) ;
305
- } ) ;
306
- } ) ;
307
258
} ) ;
0 commit comments