@@ -8,6 +8,7 @@ import { DisposableStore } from 'vs/base/common/lifecycle';
8
8
import { Schemas } from 'vs/base/common/network' ;
9
9
import { Storage } from 'vs/base/parts/storage/common/storage' ;
10
10
import { flakySuite } from 'vs/base/test/common/testUtils' ;
11
+ import { runWithFakedTimers } from 'vs/base/test/common/timeTravelScheduler' ;
11
12
import { FileService } from 'vs/platform/files/common/fileService' ;
12
13
import { InMemoryFileSystemProvider } from 'vs/platform/files/common/inMemoryFilesystemProvider' ;
13
14
import { NullLogService } from 'vs/platform/log/common/log' ;
@@ -67,19 +68,21 @@ flakySuite('StorageService (browser specific)', () => {
67
68
} ) ;
68
69
69
70
test ( 'clear' , async ( ) => {
70
- storageService . store ( 'bar' , 'foo' , StorageScope . GLOBAL , StorageTarget . MACHINE ) ;
71
- storageService . store ( 'bar' , 3 , StorageScope . GLOBAL , StorageTarget . USER ) ;
72
- storageService . store ( 'bar' , 'foo' , StorageScope . WORKSPACE , StorageTarget . MACHINE ) ;
73
- storageService . store ( 'bar' , 3 , StorageScope . WORKSPACE , StorageTarget . USER ) ;
71
+ await runWithFakedTimers ( { useFakeTimers : true } , async ( ) => {
72
+ storageService . store ( 'bar' , 'foo' , StorageScope . GLOBAL , StorageTarget . MACHINE ) ;
73
+ storageService . store ( 'bar' , 3 , StorageScope . GLOBAL , StorageTarget . USER ) ;
74
+ storageService . store ( 'bar' , 'foo' , StorageScope . WORKSPACE , StorageTarget . MACHINE ) ;
75
+ storageService . store ( 'bar' , 3 , StorageScope . WORKSPACE , StorageTarget . USER ) ;
74
76
75
- await storageService . clear ( ) ;
77
+ await storageService . clear ( ) ;
76
78
77
- for ( const scope of [ StorageScope . GLOBAL , StorageScope . WORKSPACE ] ) {
78
- for ( const target of [ StorageTarget . USER , StorageTarget . MACHINE ] ) {
79
- strictEqual ( storageService . get ( 'bar' , scope ) , undefined ) ;
80
- strictEqual ( storageService . keys ( scope , target ) . length , 0 ) ;
79
+ for ( const scope of [ StorageScope . GLOBAL , StorageScope . WORKSPACE ] ) {
80
+ for ( const target of [ StorageTarget . USER , StorageTarget . MACHINE ] ) {
81
+ strictEqual ( storageService . get ( 'bar' , scope ) , undefined ) ;
82
+ strictEqual ( storageService . keys ( scope , target ) . length , 0 ) ;
83
+ }
81
84
}
82
- }
85
+ } ) ;
83
86
} ) ;
84
87
} ) ;
85
88
0 commit comments