@@ -13,8 +13,10 @@ import {
1313 PreferencesProvider ,
1414} from 'compass-preferences-model/provider' ;
1515import { createSandboxFromDefaultPreferences } from 'compass-preferences-model' ;
16+ import type { CollectionProps } from 'mongodb-collection-model' ;
17+ import type { DatabaseProps } from 'mongodb-database-model' ;
1618
17- function createDatabase ( name ) {
19+ function createDatabase ( name : string ) : DatabaseProps {
1820 return {
1921 _id : name ,
2022 name : name ,
@@ -35,7 +37,10 @@ function createDatabase(name) {
3537 } ;
3638}
3739
38- function createCollection ( name , props : any = { } ) {
40+ function createCollection (
41+ name : string ,
42+ props : Partial < CollectionProps > = { }
43+ ) : CollectionProps {
3944 const col = {
4045 _id : name ,
4146 name : name ,
@@ -71,6 +76,7 @@ function createCollection(name, props: any = {}) {
7176 free_storage_size : 1000 ,
7277 index_count : 15 ,
7378 index_size : 16 ,
79+ calculated_storage_size : undefined ,
7480 ...props ,
7581 } ;
7682
@@ -81,21 +87,24 @@ function createCollection(name, props: any = {}) {
8187 return col ;
8288}
8389
84- function createTimeSeries ( name , props : any = { } ) {
90+ function createTimeSeries (
91+ name : string ,
92+ props : Partial < CollectionProps > = { }
93+ ) : CollectionProps {
8594 return {
8695 ...createCollection ( name , props ) ,
8796 type : 'timeseries' as const ,
8897 } ;
8998}
9099
91- const dbs = [
100+ const dbs : DatabaseProps [ ] = [
92101 createDatabase ( 'foo' ) ,
93102 createDatabase ( 'bar' ) ,
94103 createDatabase ( 'buz' ) ,
95104 createDatabase ( 'bat' ) ,
96105] ;
97106
98- const colls = [
107+ const colls : CollectionProps [ ] = [
99108 createCollection ( 'foo.foo' , { storage_size : 1000 , free_storage_size : 1000 } ) , // 1000
100109 createCollection ( 'bar.bar' , { storage_size : 2000 , free_storage_size : 500 } ) , // 1500
101110 createCollection ( 'buz.buz' , { storage_size : 3000 , free_storage_size : 2000 } ) , // 1000
@@ -112,10 +121,16 @@ describe('databases and collections list', function () {
112121
113122 afterEach ( cleanup ) ;
114123
115- const renderDatabasesList = ( props ) => {
124+ const renderDatabasesList = (
125+ props : Partial < React . ComponentProps < typeof DatabasesList > >
126+ ) => {
116127 render (
117128 < PreferencesProvider value = { preferences } >
118- < DatabasesList { ...props } > </ DatabasesList >
129+ < DatabasesList
130+ databases = { [ ] }
131+ onDatabaseClick = { ( ) => { } }
132+ { ...props }
133+ > </ DatabasesList >
119134 </ PreferencesProvider >
120135 ) ;
121136 } ;
@@ -190,10 +205,17 @@ describe('databases and collections list', function () {
190205
191206 afterEach ( cleanup ) ;
192207
193- const renderCollectionsList = ( props ) => {
208+ const renderCollectionsList = (
209+ props : Partial < React . ComponentProps < typeof CollectionsList > >
210+ ) => {
194211 render (
195212 < PreferencesProvider value = { preferences } >
196- < CollectionsList { ...props } > </ CollectionsList >
213+ < CollectionsList
214+ onCollectionClick = { ( ) => { } }
215+ namespace = "db"
216+ collections = { [ ] }
217+ { ...props }
218+ > </ CollectionsList >
197219 </ PreferencesProvider >
198220 ) ;
199221 } ;
0 commit comments