@@ -100,6 +100,12 @@ describe('/api/stats/views', () => {
100100 expect ( response . status ) . toBe ( 200 )
101101 } )
102102
103+ it ( 'supports offset-style clientTimezone values' , async ( ) => {
104+ const response = await fetchWithAuth ( '/api/stats/views?slug=0&unit=day&clientTimezone=Etc/GMT-8' )
105+
106+ expect ( response . status ) . toBe ( 200 )
107+ } )
108+
103109 it ( 'returns 400 for invalid clientTimezone format' , async ( ) => {
104110 const response = await fetchWithAuth ( '/api/stats/views?slug=0&unit=day&clientTimezone=invalid<>timezone' )
105111
@@ -124,3 +130,29 @@ describe('/api/stats/views', () => {
124130 expect ( response . status ) . toBe ( 401 )
125131 } )
126132} )
133+
134+ describe ( '/api/stats/heatmap' , ( ) => {
135+ it ( 'supports clientTimezone parameter' , async ( ) => {
136+ const response = await fetchWithAuth ( '/api/stats/heatmap?clientTimezone=Asia/Shanghai' )
137+
138+ expect ( response . status ) . toBe ( 200 )
139+ } )
140+
141+ it ( 'supports offset-style clientTimezone values' , async ( ) => {
142+ const response = await fetchWithAuth ( '/api/stats/heatmap?clientTimezone=Etc/GMT-8' )
143+
144+ expect ( response . status ) . toBe ( 200 )
145+ } )
146+
147+ it ( 'returns 400 for invalid clientTimezone format' , async ( ) => {
148+ const response = await fetchWithAuth ( '/api/stats/heatmap?clientTimezone=invalid<>timezone' )
149+
150+ expect ( response . status ) . toBe ( 400 )
151+ } )
152+
153+ it ( 'returns 401 when accessing without auth' , async ( ) => {
154+ const response = await fetch ( '/api/stats/heatmap?clientTimezone=Asia/Shanghai' )
155+
156+ expect ( response . status ) . toBe ( 401 )
157+ } )
158+ } )
0 commit comments