@@ -582,7 +582,7 @@ suite('MDBExtensionController Test Suite', function () {
582
582
. then ( done , done ) ;
583
583
} ) ;
584
584
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 ( ) => {
586
586
const mockTreeItem = new ConnectionTreeItem (
587
587
'tasty_sandwhich' ,
588
588
vscode . TreeItemCollapsibleState . None ,
@@ -592,74 +592,6 @@ suite('MDBExtensionController Test Suite', function () {
592
592
{ }
593
593
) ;
594
594
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
- ) ;
663
595
const mockActiveConnectionId : any = sinon . fake . returns ( 'tasty_sandwhich' ) ;
664
596
sinon . replace (
665
597
mdbTestExtension . testExtensionController . _connectionController ,
@@ -683,7 +615,6 @@ suite('MDBExtensionController Test Suite', function () {
683
615
) ;
684
616
assert ( mockOpenTextDocument . firstArg . content . includes ( 'NEW_DATABASE_NAME' ) ) ;
685
617
assert ( mockOpenTextDocument . firstArg . content . includes ( 'NEW_COLLECTION_NAME' ) ) ;
686
- assert ( mockOpenTextDocument . firstArg . content . includes ( 'time-series' ) ) ;
687
618
} ) ;
688
619
689
620
test ( 'mdb.addDatabase command fails when disconnecting' , ( done ) => {
@@ -782,31 +713,15 @@ suite('MDBExtensionController Test Suite', function () {
782
713
. then ( done , done ) ;
783
714
} ) ;
784
715
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 ( ) => {
797
717
const mockTreeItem = new DatabaseTreeItem (
798
718
'iceCreamDB' ,
799
- mockGetActiveDataService ,
719
+ { } ,
800
720
false ,
801
721
false ,
802
722
{ }
803
723
) ;
804
724
805
- sinon . replace (
806
- mdbTestExtension . testExtensionController . _connectionController ,
807
- 'getActiveDataService' ,
808
- mockGetActiveDataService
809
- ) ;
810
725
const mockActiveConnectionId : any = sinon . fake . returns ( 'tasty_sandwhich' ) ;
811
726
sinon . replace (
812
727
mdbTestExtension . testExtensionController . _connectionController ,
@@ -833,61 +748,6 @@ suite('MDBExtensionController Test Suite', function () {
833
748
assert ( ! mockOpenTextDocument . firstArg . content . includes ( 'time-series' ) ) ;
834
749
} ) ;
835
750
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
-
891
751
test ( 'mdb.addCollection command fails when disconnecting' , ( done ) => {
892
752
const mockTreeItem = new DatabaseTreeItem (
893
753
'iceCreamDB' ,
0 commit comments