@@ -582,7 +582,7 @@ suite('MDBExtensionController Test Suite', function () {
582582 . then ( done , done ) ;
583583 } ) ;
584584
585- test ( 'mdb.addDatabase should create a MongoDB playground with create collection template without time-series ' , async ( ) => {
585+ test ( 'mdb.addDatabase should create a MongoDB playground with create collection template' , async ( ) => {
586586 const mockTreeItem = new ConnectionTreeItem (
587587 'tasty_sandwhich' ,
588588 vscode . TreeItemCollapsibleState . None ,
@@ -592,74 +592,6 @@ suite('MDBExtensionController Test Suite', function () {
592592 { }
593593 ) ;
594594
595- const mockGetActiveDataService : any = sinon . fake . returns ( {
596- instance : ( ) => Promise . resolve ( {
597- dataLake : { } ,
598- build : { version : '4.9.7' } ,
599- genuineMongoDB : { } ,
600- host : { }
601- } ) ,
602- createCollection : ( namespace , options , callback ) => {
603- callback ( null ) ;
604- }
605- } ) ;
606- sinon . replace (
607- mdbTestExtension . testExtensionController . _connectionController ,
608- 'getActiveDataService' ,
609- mockGetActiveDataService
610- ) ;
611- const mockActiveConnectionId : any = sinon . fake . returns ( 'tasty_sandwhich' ) ;
612- sinon . replace (
613- mdbTestExtension . testExtensionController . _connectionController ,
614- 'getActiveConnectionId' ,
615- mockActiveConnectionId
616- ) ;
617-
618- const mockOpenTextDocument : any = sinon . fake . resolves ( 'untitled' ) ;
619- sinon . replace ( vscode . workspace , 'openTextDocument' , mockOpenTextDocument ) ;
620-
621- const mockShowTextDocument : any = sinon . fake ( ) ;
622- sinon . replace ( vscode . window , 'showTextDocument' , mockShowTextDocument ) ;
623-
624- await vscode . commands . executeCommand ( 'mdb.addDatabase' , mockTreeItem ) ;
625-
626- assert ( mockOpenTextDocument . firstArg . language === 'mongodb' ) ;
627- assert (
628- mockOpenTextDocument . firstArg . content . includes (
629- '// Create a new database.'
630- )
631- ) ;
632- assert ( mockOpenTextDocument . firstArg . content . includes ( 'NEW_DATABASE_NAME' ) ) ;
633- assert ( mockOpenTextDocument . firstArg . content . includes ( 'NEW_COLLECTION_NAME' ) ) ;
634- assert ( ! mockOpenTextDocument . firstArg . content . includes ( 'time-series' ) ) ;
635- } ) ;
636-
637- test ( 'mdb.addDatabase should create a MongoDB playground with create collection template with time-series' , async ( ) => {
638- const mockTreeItem = new ConnectionTreeItem (
639- 'tasty_sandwhich' ,
640- vscode . TreeItemCollapsibleState . None ,
641- false ,
642- mdbTestExtension . testExtensionController . _connectionController ,
643- false ,
644- { }
645- ) ;
646-
647- const mockGetActiveDataService : any = sinon . fake . returns ( {
648- instance : ( ) => Promise . resolve ( {
649- dataLake : { } ,
650- build : { version : '5.0.1' } ,
651- genuineMongoDB : { } ,
652- host : { }
653- } ) ,
654- createCollection : ( namespace , options , callback ) => {
655- callback ( null ) ;
656- }
657- } ) ;
658- sinon . replace (
659- mdbTestExtension . testExtensionController . _connectionController ,
660- 'getActiveDataService' ,
661- mockGetActiveDataService
662- ) ;
663595 const mockActiveConnectionId : any = sinon . fake . returns ( 'tasty_sandwhich' ) ;
664596 sinon . replace (
665597 mdbTestExtension . testExtensionController . _connectionController ,
@@ -683,7 +615,6 @@ suite('MDBExtensionController Test Suite', function () {
683615 ) ;
684616 assert ( mockOpenTextDocument . firstArg . content . includes ( 'NEW_DATABASE_NAME' ) ) ;
685617 assert ( mockOpenTextDocument . firstArg . content . includes ( 'NEW_COLLECTION_NAME' ) ) ;
686- assert ( mockOpenTextDocument . firstArg . content . includes ( 'time-series' ) ) ;
687618 } ) ;
688619
689620 test ( 'mdb.addDatabase command fails when disconnecting' , ( done ) => {
@@ -782,31 +713,15 @@ suite('MDBExtensionController Test Suite', function () {
782713 . then ( done , done ) ;
783714 } ) ;
784715
785- test ( 'mdb.addCollection should create a MongoDB playground with create collection template without time-series' , async ( ) => {
786- const mockGetActiveDataService : any = sinon . fake . returns ( {
787- instance : ( ) => Promise . resolve ( {
788- dataLake : { } ,
789- build : { version : '4.9.7' } ,
790- genuineMongoDB : { } ,
791- host : { }
792- } ) ,
793- createCollection : ( namespace , options , callback ) => {
794- callback ( null ) ;
795- }
796- } ) ;
716+ test ( 'mdb.addCollection should create a MongoDB playground with create collection template' , async ( ) => {
797717 const mockTreeItem = new DatabaseTreeItem (
798718 'iceCreamDB' ,
799- mockGetActiveDataService ,
719+ { } ,
800720 false ,
801721 false ,
802722 { }
803723 ) ;
804724
805- sinon . replace (
806- mdbTestExtension . testExtensionController . _connectionController ,
807- 'getActiveDataService' ,
808- mockGetActiveDataService
809- ) ;
810725 const mockActiveConnectionId : any = sinon . fake . returns ( 'tasty_sandwhich' ) ;
811726 sinon . replace (
812727 mdbTestExtension . testExtensionController . _connectionController ,
@@ -833,61 +748,6 @@ suite('MDBExtensionController Test Suite', function () {
833748 assert ( ! mockOpenTextDocument . firstArg . content . includes ( 'time-series' ) ) ;
834749 } ) ;
835750
836- test ( 'mdb.addCollection should create a MongoDB playground with create collection template with time-series' , async ( ) => {
837- const mockTreeItem = new DatabaseTreeItem (
838- 'iceCreamDB' ,
839- {
840- createCollection : ( namespace , options , callback ) : void => {
841- callback ( null ) ;
842- }
843- } ,
844- false ,
845- false ,
846- { }
847- ) ;
848-
849- const mockGetActiveDataService : any = sinon . fake . returns ( {
850- instance : ( ) => Promise . resolve ( {
851- dataLake : { } ,
852- build : { version : '5.0.1' } ,
853- genuineMongoDB : { } ,
854- host : { }
855- } ) ,
856- createCollection : ( namespace , options , callback ) => {
857- callback ( null ) ;
858- }
859- } ) ;
860- sinon . replace (
861- mdbTestExtension . testExtensionController . _connectionController ,
862- 'getActiveDataService' ,
863- mockGetActiveDataService
864- ) ;
865- const mockActiveConnectionId : any = sinon . fake . returns ( 'tasty_sandwhich' ) ;
866- sinon . replace (
867- mdbTestExtension . testExtensionController . _connectionController ,
868- 'getActiveConnectionId' ,
869- mockActiveConnectionId
870- ) ;
871-
872- const mockOpenTextDocument : any = sinon . fake . resolves ( 'untitled' ) ;
873- sinon . replace ( vscode . workspace , 'openTextDocument' , mockOpenTextDocument ) ;
874-
875- const mockShowTextDocument : any = sinon . fake ( ) ;
876- sinon . replace ( vscode . window , 'showTextDocument' , mockShowTextDocument ) ;
877-
878- await vscode . commands . executeCommand ( 'mdb.addCollection' , mockTreeItem ) ;
879-
880- assert ( mockOpenTextDocument . firstArg . language === 'mongodb' ) ;
881- assert (
882- mockOpenTextDocument . firstArg . content . includes (
883- '// The current database to use.'
884- )
885- ) ;
886- assert ( mockOpenTextDocument . firstArg . content . includes ( 'iceCreamDB' ) ) ;
887- assert ( mockOpenTextDocument . firstArg . content . includes ( 'NEW_COLLECTION_NAME' ) ) ;
888- assert ( mockOpenTextDocument . firstArg . content . includes ( 'time-series' ) ) ;
889- } ) ;
890-
891751 test ( 'mdb.addCollection command fails when disconnecting' , ( done ) => {
892752 const mockTreeItem = new DatabaseTreeItem (
893753 'iceCreamDB' ,
0 commit comments