@@ -35,6 +35,7 @@ describe("versions secret put", () => {
3535 mockSetupApiCalls ( ) ;
3636 mockPostVersion ( ( metadata ) => {
3737 expect ( metadata . bindings ) . toStrictEqual ( [
38+ { type : "inherit" , name : "do-binding" } ,
3839 { type : "secret_text" , name : "NEW_SECRET" , text : "the-secret" } ,
3940 ] ) ;
4041 expect ( metadata . keep_bindings ) . toStrictEqual ( [
@@ -97,6 +98,7 @@ describe("versions secret put", () => {
9798 mockSetupApiCalls ( ) ;
9899 mockPostVersion ( ( metadata ) => {
99100 expect ( metadata . bindings ) . toStrictEqual ( [
101+ { type : "inherit" , name : "do-binding" } ,
100102 { type : "secret_text" , name : "NEW_SECRET" , text : "the-secret" } ,
101103 ] ) ;
102104 expect ( metadata . keep_bindings ) . toStrictEqual ( [
@@ -138,6 +140,7 @@ describe("versions secret put", () => {
138140 mockSetupApiCalls ( ) ;
139141 mockPostVersion ( ( metadata ) => {
140142 expect ( metadata . bindings ) . toStrictEqual ( [
143+ { type : "inherit" , name : "do-binding" } ,
141144 { type : "secret_text" , name : "NEW_SECRET" , text : "the-secret" } ,
142145 ] ) ;
143146 expect ( metadata . keep_bindings ) . toStrictEqual ( [
@@ -178,6 +181,7 @@ describe("versions secret put", () => {
178181 mockSetupApiCalls ( ) ;
179182 mockPostVersion ( ( metadata ) => {
180183 expect ( metadata . bindings ) . toStrictEqual ( [
184+ { type : "inherit" , name : "do-binding" } ,
181185 { type : "secret_text" , name : "NEW_SECRET" , text : "the-secret" } ,
182186 ] ) ;
183187 expect ( metadata . keep_bindings ) . toStrictEqual ( [
@@ -208,6 +212,7 @@ describe("versions secret put", () => {
208212 mockSetupApiCalls ( ) ;
209213 mockPostVersion ( ( metadata ) => {
210214 expect ( metadata . bindings ) . toStrictEqual ( [
215+ { type : "inherit" , name : "do-binding" } ,
211216 { type : "secret_text" , name : "NEW_SECRET" , text : "the-secret" } ,
212217 ] ) ;
213218 expect ( metadata . keep_bindings ) . toStrictEqual ( [
@@ -245,6 +250,7 @@ describe("versions secret put", () => {
245250 mockSetupApiCalls ( ) ;
246251 mockPostVersion ( ( metadata ) => {
247252 expect ( metadata . bindings ) . toStrictEqual ( [
253+ { type : "inherit" , name : "do-binding" } ,
248254 { type : "secret_text" , name : "NEW_SECRET" , text : "the-secret" } ,
249255 ] ) ;
250256 expect ( metadata . keep_bindings ) . toStrictEqual ( [
@@ -273,6 +279,38 @@ describe("versions secret put", () => {
273279 expect ( std . err ) . toMatchInlineSnapshot ( `""` ) ;
274280 } ) ;
275281
282+ test ( "all non-secret bindings are inherited" , async ( ) => {
283+ setIsTTY ( true ) ;
284+
285+ mockSetupApiCalls ( ) ;
286+
287+ mockPrompt ( {
288+ text : "Enter a secret value:" ,
289+ options : { isSecret : true } ,
290+ result : "the-secret" ,
291+ } ) ;
292+
293+ mockPostVersion ( ( metadata ) => {
294+ expect ( metadata . bindings ) . toStrictEqual ( [
295+ { type : "inherit" , name : "do-binding" } ,
296+ { type : "secret_text" , name : "SECRET" , text : "the-secret" } ,
297+ ] ) ;
298+ expect ( metadata . keep_bindings ) . toStrictEqual ( [
299+ "secret_key" ,
300+ "secret_text" ,
301+ ] ) ;
302+ expect ( metadata . annotations ) . not . toBeUndefined ( ) ;
303+ } ) ;
304+ await runWrangler ( "versions secret put SECRET --name script-name" ) ;
305+
306+ expect ( std . out ) . toMatchInlineSnapshot ( `
307+ "🌀 Creating the secret for the Worker \\"script-name\\"
308+ ✨ Success! Created version id with secret SECRET.
309+ ➡️ To deploy this version with secret SECRET to production traffic use the command \\"wrangler versions deploy\\"."
310+ ` ) ;
311+ expect ( std . err ) . toMatchInlineSnapshot ( `""` ) ;
312+ } ) ;
313+
276314 test ( "can update an existing secret" , async ( ) => {
277315 setIsTTY ( true ) ;
278316
@@ -285,6 +323,7 @@ describe("versions secret put", () => {
285323 mockSetupApiCalls ( ) ;
286324 mockPostVersion ( ( metadata ) => {
287325 expect ( metadata . bindings ) . toStrictEqual ( [
326+ { type : "inherit" , name : "do-binding" } ,
288327 { type : "secret_text" , name : "SECRET" , text : "the-secret" } ,
289328 ] ) ;
290329 expect ( metadata . keep_bindings ) . toStrictEqual ( [
@@ -361,6 +400,7 @@ describe("versions secret put", () => {
361400 expect ( ( formData . get ( "module.wasm" ) as File ) . size ) . equal ( 10 ) ;
362401
363402 expect ( metadata . bindings ) . toStrictEqual ( [
403+ { type : "inherit" , name : "do-binding" } ,
364404 { type : "secret_text" , name : "SECRET" , text : "the-secret" } ,
365405 ] ) ;
366406 expect ( metadata . keep_bindings ) . toStrictEqual ( [
0 commit comments