@@ -109,6 +109,7 @@ describe("assertTimeoutSecondsValid", () => {
109109 expect ( ( ) => assertTimeoutSecondsValid ( { } , "event" ) ) . to . not . throw ( ) ;
110110 expect ( ( ) => assertTimeoutSecondsValid ( { } , "https" ) ) . to . not . throw ( ) ;
111111 expect ( ( ) => assertTimeoutSecondsValid ( { } , "task" ) ) . to . not . throw ( ) ;
112+ expect ( ( ) => assertTimeoutSecondsValid ( { } , "identity" ) ) . to . not . throw ( ) ;
112113 } ) ;
113114
114115 it ( "accepts values within each kind's limit" , ( ) => {
@@ -117,6 +118,7 @@ describe("assertTimeoutSecondsValid", () => {
117118 expect ( ( ) => assertTimeoutSecondsValid ( { timeoutSeconds : 1800 } , "task" ) ) . to . not . throw ( ) ;
118119 expect ( ( ) => assertTimeoutSecondsValid ( { timeoutSeconds : 0 } , "event" ) ) . to . not . throw ( ) ;
119120 expect ( ( ) => assertTimeoutSecondsValid ( { timeoutSeconds : 1 } , "event" ) ) . to . not . throw ( ) ;
121+ expect ( ( ) => assertTimeoutSecondsValid ( { timeoutSeconds : 7 } , "identity" ) ) . to . not . throw ( ) ;
120122 } ) ;
121123
122124 it ( "throws when timeoutSeconds exceeds the event-handler limit" , ( ) => {
@@ -137,6 +139,12 @@ describe("assertTimeoutSecondsValid", () => {
137139 ) ;
138140 } ) ;
139141
142+ it ( "throws when timeoutSeconds exceeds the identity limit" , ( ) => {
143+ expect ( ( ) => assertTimeoutSecondsValid ( { timeoutSeconds : 8 } , "identity" ) ) . to . throw (
144+ / b e t w e e n 0 a n d 7 f o r b l o c k i n g f u n c t i o n s /
145+ ) ;
146+ } ) ;
147+
140148 it ( "throws when timeoutSeconds is negative" , ( ) => {
141149 expect ( ( ) => assertTimeoutSecondsValid ( { timeoutSeconds : - 1 } , "event" ) ) . to . throw (
142150 / b e t w e e n 0 a n d 5 4 0 /
@@ -180,6 +188,8 @@ describe("assertTimeoutSecondsValid", () => {
180188 / b e t w e e n 0 a n d 5 4 0 f o r e v e n t - h a n d l i n g f u n c t i o n s /
181189 ) ;
182190 expect ( ( ) => assertTimeoutSecondsValid ( { } , "https" ) ) . to . not . throw ( ) ;
191+ expect ( ( ) => assertTimeoutSecondsValid ( { } , "task" ) ) . to . throw ( ) ;
192+ expect ( ( ) => assertTimeoutSecondsValid ( { } , "identity" ) ) . to . throw ( ) ;
183193 } ) ;
184194
185195 it ( "prefers the function-level timeoutSeconds over the global one" , ( ) => {
@@ -216,12 +226,14 @@ describe("optionsToEndpoint timeout validation", () => {
216226 expect ( ( ) => optionsToEndpoint ( { timeoutSeconds : 1801 } , "task" ) ) . to . throw (
217227 / b e t w e e n 0 a n d 1 8 0 0 /
218228 ) ;
229+ expect ( ( ) => optionsToEndpoint ( { timeoutSeconds : 8 } , "identity" ) ) . to . throw ( / b e t w e e n 0 a n d 7 / ) ;
219230 } ) ;
220231
221232 it ( "is a no-op for in-range timeouts when kind is provided" , ( ) => {
222233 expect ( ( ) => optionsToEndpoint ( { timeoutSeconds : 540 } , "event" ) ) . to . not . throw ( ) ;
223234 expect ( ( ) => optionsToEndpoint ( { timeoutSeconds : 3600 } , "https" ) ) . to . not . throw ( ) ;
224235 expect ( ( ) => optionsToEndpoint ( { timeoutSeconds : 1800 } , "task" ) ) . to . not . throw ( ) ;
236+ expect ( ( ) => optionsToEndpoint ( { timeoutSeconds : 7 } , "identity" ) ) . to . not . throw ( ) ;
225237 } ) ;
226238} ) ;
227239
@@ -244,11 +256,15 @@ describe("optionsToTriggerAnnotations timeout validation", () => {
244256 expect ( ( ) => optionsToTriggerAnnotations ( { timeoutSeconds : 1801 } , "task" ) ) . to . throw (
245257 / b e t w e e n 0 a n d 1 8 0 0 /
246258 ) ;
259+ expect ( ( ) => optionsToTriggerAnnotations ( { timeoutSeconds : 8 } , "identity" ) ) . to . throw (
260+ / b e t w e e n 0 a n d 7 /
261+ ) ;
247262 } ) ;
248263
249264 it ( "is a no-op for in-range timeouts when kind is provided" , ( ) => {
250265 expect ( ( ) => optionsToTriggerAnnotations ( { timeoutSeconds : 540 } , "event" ) ) . to . not . throw ( ) ;
251266 expect ( ( ) => optionsToTriggerAnnotations ( { timeoutSeconds : 3600 } , "https" ) ) . to . not . throw ( ) ;
252267 expect ( ( ) => optionsToTriggerAnnotations ( { timeoutSeconds : 1800 } , "task" ) ) . to . not . throw ( ) ;
268+ expect ( ( ) => optionsToTriggerAnnotations ( { timeoutSeconds : 7 } , "identity" ) ) . to . not . throw ( ) ;
253269 } ) ;
254270} ) ;
0 commit comments