File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,13 +7,20 @@ describe("buzzSetupContract", () => {
77 vi . unstubAllEnvs ( ) ;
88 } ) ;
99
10- it ( "removes a stored private key when switching to BUZZ_PRIVATE_KEY " , ( ) => {
10+ it ( "validates and applies BUZZ_PRIVATE_KEY setup without storing the key " , ( ) => {
1111 expect ( buzzSetupContract . metadata . fields . find ( ( field ) => field . key === "useEnv" ) ) . toMatchObject (
1212 {
1313 kind : "boolean" ,
1414 envVars : [ "BUZZ_PRIVATE_KEY" ] ,
1515 } ,
1616 ) ;
17+ expect (
18+ buzzSetupContract . validateInput ?.( {
19+ cfg : { } ,
20+ accountId : "default" ,
21+ input : { relayUrl : "wss://buzz.example.com" , useEnv : true } ,
22+ } ) ,
23+ ) . toBeNull ( ) ;
1724 vi . stubEnv ( "BUZZ_PRIVATE_KEY" , "22" . repeat ( 32 ) ) ;
1825 const cfg = {
1926 channels : {
Original file line number Diff line number Diff line change @@ -13,12 +13,22 @@ import {
1313import { telegramSetupWizard } from "./setup-surface.js" ;
1414
1515describe ( "Telegram setup promotion contract" , ( ) => {
16- it ( "exposes webhookSecret without widening named-account promotion" , ( ) => {
16+ it ( "covers named-account promotion and environment setup" , ( ) => {
17+ const input = {
18+ cfg : { } ,
19+ accountId : DEFAULT_ACCOUNT_ID ,
20+ input : { useEnv : true } ,
21+ } ;
1722 expect ( telegramSetupAdapter . singleAccountKeysToMove ) . toEqual ( [ "streaming" , "webhookSecret" ] ) ;
1823 expect ( telegramSetupAdapter . namedAccountPromotionKeys ) . toEqual ( [ "botToken" , "tokenFile" ] ) ;
1924 expect (
2025 telegramSetupContract . metadata . fields . find ( ( field ) => field . key === "useEnv" ) ,
2126 ) . toMatchObject ( { kind : "boolean" , envVars : [ "TELEGRAM_BOT_TOKEN" ] } ) ;
27+ expect ( telegramSetupContract . validateInput ?.( input ) ) . toBeNull ( ) ;
28+ const cfg = telegramSetupContract . applyAccountConfig ( input ) ;
29+ expect ( cfg . channels ?. telegram ) . toEqual ( { enabled : true } ) ;
30+ expect ( cfg . channels ?. telegram ?. botToken ) . toBeUndefined ( ) ;
31+ expect ( cfg . channels ?. telegram ?. tokenFile ) . toBeUndefined ( ) ;
2232 } ) ;
2333} ) ;
2434
You can’t perform that action at this time.
0 commit comments