@@ -44,8 +44,9 @@ describe("loadConfig", () => {
4444 it ( "does not open the keeper key file" , ( ) => {
4545 // Read-only commands run on machines that hold no key. Loading config must
4646 // not touch the path, so an unreadable path is not an error here.
47- const config = loadConfig ( completeEnv ( { LK_KEEPER_KEY : "/nonexistent/nope.key" } ) ) ;
48- expect ( config . keeperKeyPath ) . toBe ( "/nonexistent/nope.key" ) ;
47+ const env = completeEnv ( { LK_KEEPER_KEY : "/nonexistent/nope.key" } ) ;
48+ expect ( ( ) => loadConfig ( env ) ) . not . toThrow ( ) ;
49+ expect ( loadConfig ( env ) . keeperKeyPath ) . toBe ( "/nonexistent/nope.key" ) ;
4950 } ) ;
5051
5152 it ( "names the missing variable" , ( ) => {
@@ -89,6 +90,21 @@ describe("loadConfig", () => {
8990 it ( "rejects a malformed RPC URL" , ( ) => {
9091 expect ( ( ) => loadConfig ( completeEnv ( { LK_RPC_URL : "not a url" } ) ) ) . toThrow ( / n o t a v a l i d U R L / ) ;
9192 } ) ;
93+
94+ it ( "rejects a URL whose scheme the RPC client cannot speak" , ( ) => {
95+ // Parses fine, but nothing downstream could ever use it.
96+ expect ( ( ) => loadConfig ( completeEnv ( { LK_RPC_URL : "file:///etc/passwd" } ) ) ) . toThrow (
97+ / m u s t b e a n h t t p o r h t t p s U R L / ,
98+ ) ;
99+ expect ( ( ) => loadConfig ( completeEnv ( { LK_RPC_URL : "ftp://example.com" } ) ) ) . toThrow (
100+ / m u s t b e a n h t t p o r h t t p s U R L / ,
101+ ) ;
102+ } ) ;
103+
104+ it ( "accepts a loopback http URL for a local quickstart" , ( ) => {
105+ const config = loadConfig ( completeEnv ( { LK_RPC_URL : "http://localhost:8000/soroban/rpc" } ) ) ;
106+ expect ( config . rpcUrl ) . toBe ( "http://localhost:8000/soroban/rpc" ) ;
107+ } ) ;
92108} ) ;
93109
94110describe ( "loadKeypair" , ( ) => {
0 commit comments