@@ -11,7 +11,7 @@ import { UpdateResult } from './result';
11
11
import { CliServiceProvider } from '../../service-provider-server' ;
12
12
import { startTestCluster , skipIfServerVersion , skipIfApiStrict } from '../../../testing/integration-testing-hooks' ;
13
13
import Database from './database' ;
14
- import { ObjectId } from 'mongodb ' ;
14
+ import { inspect } from 'util ' ;
15
15
16
16
describe ( 'Shard' , ( ) => {
17
17
skipIfApiStrict ( ) ;
@@ -685,7 +685,7 @@ describe('Shard', () => {
685
685
686
686
it ( 'returns whatever serviceProvider.updateOne returns' , async ( ) => {
687
687
serviceProvider . runCommandWithCheck . resolves ( { ok : 1 , msg : 'isdbgrid' } ) ;
688
- const oid = new ObjectId ( ) ;
688
+ const oid = new bson . ObjectId ( ) ;
689
689
const expectedResult = {
690
690
matchedCount : 1 ,
691
691
modifiedCount : 1 ,
@@ -744,7 +744,7 @@ describe('Shard', () => {
744
744
745
745
it ( 'returns whatever serviceProvider.updateOne returns' , async ( ) => {
746
746
serviceProvider . runCommandWithCheck . resolves ( { ok : 1 , msg : 'isdbgrid' } ) ;
747
- const oid = new ObjectId ( ) ;
747
+ const oid = new bson . ObjectId ( ) ;
748
748
const expectedResult = {
749
749
matchedCount : 1 ,
750
750
modifiedCount : 1 ,
@@ -919,7 +919,7 @@ describe('Shard', () => {
919
919
920
920
it ( 'returns whatever serviceProvider.updateOne returns' , async ( ) => {
921
921
serviceProvider . runCommandWithCheck . resolves ( { ok : 1 , msg : 'isdbgrid' } ) ;
922
- const oid = new ObjectId ( ) ;
922
+ const oid = new bson . ObjectId ( ) ;
923
923
const expectedResult = {
924
924
matchedCount : 1 ,
925
925
modifiedCount : 1 ,
@@ -977,7 +977,7 @@ describe('Shard', () => {
977
977
978
978
it ( 'returns whatever serviceProvider.updateOne returns' , async ( ) => {
979
979
serviceProvider . runCommandWithCheck . resolves ( { ok : 1 , msg : 'isdbgrid' } ) ;
980
- const oid = new ObjectId ( ) ;
980
+ const oid = new bson . ObjectId ( ) ;
981
981
const expectedResult = {
982
982
matchedCount : 1 ,
983
983
modifiedCount : 1 ,
@@ -1285,7 +1285,14 @@ describe('Shard', () => {
1285
1285
expect ( original . key ) . to . equal ( 'A' ) ;
1286
1286
expect ( original . value ) . to . equal ( 10 ) ;
1287
1287
1288
- expect ( ( await sh . status ( ) ) . value . databases [ 1 ] . collections [ ns ] . chunkMetadata ) . to . have . lengthOf ( 1 ) ;
1288
+ const collectionInfo = ( await sh . status ( ) ) . value . databases [ 1 ] . collections [ ns ] ;
1289
+ expect ( collectionInfo . chunkMetadata ) . to . have . lengthOf ( 1 ) ;
1290
+ const inspectedCollectionInfo = inspect ( collectionInfo ) ;
1291
+ // Make sure that each individual chunk in the output is on a single line
1292
+ expect ( inspectedCollectionInfo ) . to . include ( 'chunks: [\n' +
1293
+ ' { min: { key: MinKey() }, max: { key: MaxKey() }, ' +
1294
+ `'on shard': '${ collectionInfo . chunks [ 0 ] [ 'on shard' ] } ', 'last modified': Timestamp(0, 1) }\n` +
1295
+ ' ],\n' ) ;
1289
1296
} ) ;
1290
1297
} ) ;
1291
1298
describe ( 'autosplit' , ( ) => {
0 commit comments