File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 1
1
import {
2
+ getCacheSizes ,
2
3
clearCache ,
3
4
clearTLEParseCache ,
4
5
getGroundTracks ,
@@ -109,6 +110,25 @@ describe("getLatLngObj", () => {
109
110
} ) ;
110
111
} ) ;
111
112
113
+ describe ( 'clearCache' , ( ) => {
114
+ test ( 'clears the cache' , ( ) => {
115
+ const timestamp = 1501039268000 ;
116
+ const bigBearLatLng = {
117
+ lat : 34.243889 ,
118
+ lng : - 116.911389
119
+ } ;
120
+ getSatelliteInfo (
121
+ tleStr ,
122
+ timestamp ,
123
+ bigBearLatLng . lat ,
124
+ bigBearLatLng . lng
125
+ ) ;
126
+ expect ( getCacheSizes ( ) ) . toEqual ( [ 3 , 0 , 0 , 0 ] ) ;
127
+ clearCache ( ) ;
128
+ expect ( getCacheSizes ( ) ) . toEqual ( [ 0 , 0 , 0 , 0 ] ) ;
129
+ } ) ;
130
+ } ) ;
131
+
112
132
describe ( "getOrbitTrack" , ( ) => {
113
133
beforeEach ( ( ) => {
114
134
clearCache ( ) ;
Original file line number Diff line number Diff line change @@ -54,8 +54,8 @@ export function getCacheSizes() {
54
54
* Clears SGP caches to free up memory for long-running apps.
55
55
*/
56
56
export function clearCache ( ) {
57
- caches . forEach ( cache => {
58
- caches [ cache ] = { } ;
57
+ caches . forEach ( ( _cache , idx ) => {
58
+ caches [ idx ] = { } ;
59
59
} ) ;
60
60
}
61
61
You can’t perform that action at this time.
0 commit comments