@@ -14,7 +14,6 @@ import sinon from 'sinon';
1414import { createSandboxFromDefaultPreferences } from 'compass-preferences-model' ;
1515import type { PreferencesAccess } from 'compass-preferences-model' ;
1616import { PreferencesProvider } from 'compass-preferences-model/provider' ;
17- import type { RecentQuery } from '@mongodb-js/my-queries-storage' ;
1817
1918class MockPasteEvent extends window . Event {
2019 constructor ( private text : string ) {
@@ -48,7 +47,8 @@ describe('OptionEditor', function () {
4847 insertEmptyDocOnFocus
4948 onChange = { ( ) => { } }
5049 value = ""
51- savedQueries = { [ ] }
50+ recentQueries = { [ ] }
51+ favoriteQueries = { [ ] }
5252 onApplyQuery = { applyFromHistory }
5353 > </ OptionEditor >
5454 ) ;
@@ -70,7 +70,8 @@ describe('OptionEditor', function () {
7070 insertEmptyDocOnFocus
7171 onChange = { ( ) => { } }
7272 value = "{ foo: 1 }"
73- savedQueries = { [ ] }
73+ recentQueries = { [ ] }
74+ favoriteQueries = { [ ] }
7475 onApplyQuery = { applyFromHistory }
7576 > </ OptionEditor >
7677 ) ;
@@ -92,7 +93,8 @@ describe('OptionEditor', function () {
9293 insertEmptyDocOnFocus
9394 onChange = { ( ) => { } }
9495 value = ""
95- savedQueries = { [ ] }
96+ favoriteQueries = { [ ] }
97+ recentQueries = { [ ] }
9698 onApplyQuery = { applyFromHistory }
9799 > </ OptionEditor >
98100 ) ;
@@ -120,7 +122,8 @@ describe('OptionEditor', function () {
120122 insertEmptyDocOnFocus
121123 onChange = { ( ) => { } }
122124 value = ""
123- savedQueries = { [ ] }
125+ favoriteQueries = { [ ] }
126+ recentQueries = { [ ] }
124127 onApplyQuery = { applyFromHistory }
125128 > </ OptionEditor >
126129 ) ;
@@ -150,7 +153,8 @@ describe('OptionEditor', function () {
150153 insertEmptyDocOnFocus
151154 onChange = { ( ) => { } }
152155 value = ""
153- savedQueries = { [ ] }
156+ favoriteQueries = { [ ] }
157+ recentQueries = { [ ] }
154158 onApplyQuery = { applyFromHistory }
155159 > </ OptionEditor >
156160 ) ;
@@ -183,21 +187,17 @@ describe('OptionEditor', function () {
183187 insertEmptyDocOnFocus
184188 onChange = { ( ) => { } }
185189 value = ""
186- savedQueries = { [
190+ recentQueries = { [
187191 {
188- type : 'recent' ,
189- lastExecuted : new Date ( ) ,
190- queryProperties : {
191- filter : { a : 1 } ,
192- } ,
192+ _lastExecuted : new Date ( ) ,
193+ filter : { a : 1 } ,
193194 } ,
195+ ] }
196+ favoriteQueries = { [
194197 {
195- type : 'favorite' ,
196- lastExecuted : new Date ( ) ,
197- queryProperties : {
198- filter : { a : 2 } ,
199- sort : { a : - 1 } ,
200- } ,
198+ _lastExecuted : new Date ( ) ,
199+ filter : { a : 2 } ,
200+ sort : { a : - 1 } ,
201201 } ,
202202 ] }
203203 onApplyQuery = { onApplySpy }
@@ -249,20 +249,16 @@ describe('OptionEditor', function () {
249249 insertEmptyDocOnFocus
250250 onChange = { ( ) => { } }
251251 value = ""
252- savedQueries = { [
252+ favoriteQueries = { [
253253 {
254- type : 'favorite' ,
255- lastExecuted : new Date ( ) ,
256- queryProperties : {
257- project : { a : 1 } ,
258- } ,
254+ _lastExecuted : new Date ( ) ,
255+ project : { a : 1 } ,
259256 } ,
257+ ] }
258+ recentQueries = { [
260259 {
261- type : 'recent' ,
262- lastExecuted : new Date ( ) ,
263- queryProperties : {
264- project : { a : 0 } ,
265- } ,
260+ _lastExecuted : new Date ( ) ,
261+ project : { a : 0 } ,
266262 } ,
267263 ] }
268264 onApplyQuery = { onApplySpy }
@@ -310,21 +306,21 @@ describe('OptionEditor', function () {
310306 skip : 1 ,
311307 limit : 1 ,
312308 } ,
313- ] as unknown as RecentQuery [ ] ;
309+ ] ;
314310
315311 it ( 'filters out update queries' , function ( ) {
316312 const queries = getOptionBasedQueries ( 'filter' , 'recent' , [
317313 ...savedQueries ,
318314 { _lastExecuted : new Date ( ) , update : { a : 1 } , filter : { a : 2 } } ,
319- ] as unknown as RecentQuery [ ] ) ;
315+ ] ) ;
320316 expect ( queries . length ) . to . equal ( 1 ) ;
321317 } ) ;
322318
323319 it ( 'filters out empty queries' , function ( ) {
324320 const queries = getOptionBasedQueries ( 'filter' , 'recent' , [
325321 ...savedQueries ,
326322 { _lastExecuted : new Date ( ) } ,
327- ] as unknown as RecentQuery [ ] ) ;
323+ ] ) ;
328324 expect ( queries . length ) . to . equal ( 1 ) ;
329325 } ) ;
330326
@@ -335,7 +331,7 @@ describe('OptionEditor', function () {
335331 ...savedQueries ,
336332 { _lastExecuted : new Date ( ) } ,
337333 { _lastExecuted : new Date ( ) } ,
338- ] as unknown as RecentQuery [ ] ) ;
334+ ] ) ;
339335 expect ( queries . length ) . to . equal ( 1 ) ;
340336 } ) ;
341337
@@ -365,9 +361,9 @@ describe('OptionEditor', function () {
365361
366362 expect ( queries ) . to . deep . equal ( [
367363 {
368- type : 'recent' ,
369364 lastExecuted : savedQueries [ 0 ] . _lastExecuted ,
370365 queryProperties,
366+ type : 'recent' ,
371367 } ,
372368 ] ) ;
373369 } ) ;
0 commit comments