@@ -12,7 +12,6 @@ vi.mock("cloudflare:workers", () => ({
1212 } ,
1313} ) ) ;
1414
15-
1615const createBucketCachePurge = ( ) => {
1716 const mockState = {
1817 waitUntil : vi . fn ( ) ,
@@ -39,7 +38,7 @@ describe("BucketCachePurge", () => {
3938 expect ( cache . ctx . blockConcurrencyWhile ) . toHaveBeenCalled ( ) ;
4039 // @ts -expect-error - testing private method
4140 expect ( cache . ctx . storage . sql . exec ) . toHaveBeenCalledWith (
42- expect . stringContaining ( "CREATE TABLE IF NOT EXISTS cache_purge" ) ,
41+ expect . stringContaining ( "CREATE TABLE IF NOT EXISTS cache_purge" )
4342 ) ;
4443 } ) ;
4544
@@ -51,12 +50,12 @@ describe("BucketCachePurge", () => {
5150 // @ts -expect-error - testing private method
5251 expect ( cache . ctx . storage . sql . exec ) . toHaveBeenCalledWith (
5352 expect . stringContaining ( "INSERT OR REPLACE INTO cache_purge" ) ,
54- [ tags [ 0 ] ] ,
53+ [ tags [ 0 ] ]
5554 ) ;
5655 // @ts -expect-error - testing private method
5756 expect ( cache . ctx . storage . sql . exec ) . toHaveBeenCalledWith (
5857 expect . stringContaining ( "INSERT OR REPLACE INTO cache_purge" ) ,
59- [ tags [ 1 ] ] ,
58+ [ tags [ 1 ] ]
6059 ) ;
6160 } ) ;
6261
@@ -77,7 +76,7 @@ describe("BucketCachePurge", () => {
7776 // @ts -expect-error - testing private method
7877 expect ( cache . ctx . storage . setAlarm ) . not . toHaveBeenCalled ( ) ;
7978 } ) ;
80- } )
79+ } ) ;
8180
8281 describe ( "alarm" , ( ) => {
8382 it ( "should purge cache by tags and delete them from the sql table" , async ( ) => {
@@ -90,7 +89,7 @@ describe("BucketCachePurge", () => {
9089 // @ts -expect-error - testing private method
9190 expect ( cache . ctx . storage . sql . exec ) . toHaveBeenCalledWith (
9291 expect . stringContaining ( "DELETE FROM cache_purge" ) ,
93- [ "tag1" , "tag2" ] ,
92+ [ "tag1" , "tag2" ]
9493 ) ;
9594 } ) ;
9695 it ( "should not purge cache if no tags are found" , async ( ) => {
@@ -103,7 +102,7 @@ describe("BucketCachePurge", () => {
103102 // @ts -expect-error - testing private method
104103 expect ( cache . ctx . storage . sql . exec ) . not . toHaveBeenCalledWith (
105104 expect . stringContaining ( "DELETE FROM cache_purge" ) ,
106- [ ] ,
105+ [ ]
107106 ) ;
108107 } ) ;
109108
@@ -119,7 +118,7 @@ describe("BucketCachePurge", () => {
119118 expect ( internalPurgeCacheByTagsSpy ) . toHaveBeenCalledWith (
120119 // @ts -expect-error - testing private method
121120 cache . env ,
122- tags ,
121+ tags
123122 ) ;
124123 // @ts -expect-error - testing private method 1st is constructor, 2nd is to get the tags and 3rd is to delete them
125124 expect ( cache . ctx . storage . sql . exec ) . toHaveBeenCalledTimes ( 3 ) ;
@@ -137,16 +136,14 @@ describe("BucketCachePurge", () => {
137136 expect ( internalPurgeCacheByTagsSpy ) . toHaveBeenCalledWith (
138137 // @ts -expect-error - testing private method
139138 cache . env ,
140- tags ,
139+ tags
141140 ) ;
142141 // @ts -expect-error - testing private method 1st is constructor, 2nd is to get the tags and 3rd is to delete them, 4th is to get the next 100 tags
143142 expect ( cache . ctx . storage . sql . exec ) . toHaveBeenCalledTimes ( 4 ) ;
144143 // @ts -expect-error - testing private method
145144 expect ( cache . ctx . storage . sql . exec ) . toHaveBeenLastCalledWith (
146- expect . stringContaining ( "SELECT * FROM cache_purge LIMIT 100" ) ,
145+ expect . stringContaining ( "SELECT * FROM cache_purge LIMIT 100" )
147146 ) ;
148147 } ) ;
149-
150-
151- } )
152- } ) ;
148+ } ) ;
149+ } ) ;
0 commit comments