@@ -52,6 +52,26 @@ describe("cloudchamber create", () => {
5252 ` ) ;
5353 } ) ;
5454
55+ it ( "should fail with a nice message when parameters are missing" , async ( ) => {
56+ setIsTTY ( false ) ;
57+ setWranglerConfig ( { } ) ;
58+ await expect (
59+ runWrangler ( "cloudchamber create --image hello:world" )
60+ ) . rejects . toThrowErrorMatchingInlineSnapshot (
61+ `[Error: location is required but it's not passed as an argument]`
62+ ) ;
63+ } ) ;
64+
65+ it ( "should fail with a nice message when parameters are missing (json)" , async ( ) => {
66+ setIsTTY ( false ) ;
67+ setWranglerConfig ( { } ) ;
68+ await runWrangler ( "cloudchamber create --image hello:world --json" ) ;
69+ expect ( std . out ) . toMatchInlineSnapshot (
70+ `"{\\"error\\":\\"location is required but it's not passed as an argument\\"}"`
71+ ) ;
72+ expect ( std . err ) . toMatchInlineSnapshot ( `""` ) ;
73+ } ) ;
74+
5575 it ( "should create deployment (detects no interactivity)" , async ( ) => {
5676 setIsTTY ( false ) ;
5777 setWranglerConfig ( { } ) ;
@@ -86,26 +106,26 @@ describe("cloudchamber create", () => {
86106 // so testing the actual UI will be harder than expected
87107 // TODO: think better on how to test UI actions
88108 expect ( std . out ) . toMatchInlineSnapshot ( `
89- "{
90- \\"id\\": \\"1\\",
91- \\"type\\": \\"default\\",
92- \\"created_at\\": \\"123\\",
93- \\"account_id\\": \\"123\\",
94- \\"vcpu\\": 4,
95- \\"memory\\": \\"400MB\\",
96- \\"version\\": 1,
97- \\"image\\": \\"hello\\",
98- \\"location\\": {
99- \\"name\\": \\"sfo06\\",
100- \\"enabled\\": true
101- },
102- \\"network\\": {
103- \\"ipv4\\": \\"1.1.1.1\\"
104- },
105- \\"placements_ref\\": \\"http://ref\\",
106- \\"node_group\\": \\"metal\\"
107- }"
108- ` ) ;
109+ "{
110+ \\"id\\": \\"1\\",
111+ \\"type\\": \\"default\\",
112+ \\"created_at\\": \\"123\\",
113+ \\"account_id\\": \\"123\\",
114+ \\"vcpu\\": 4,
115+ \\"memory\\": \\"400MB\\",
116+ \\"version\\": 1,
117+ \\"image\\": \\"hello\\",
118+ \\"location\\": {
119+ \\"name\\": \\"sfo06\\",
120+ \\"enabled\\": true
121+ },
122+ \\"network\\": {
123+ \\"ipv4\\": \\"1.1.1.1\\"
124+ },
125+ \\"placements_ref\\": \\"http://ref\\",
126+ \\"node_group\\": \\"metal\\"
127+ }"
128+ ` ) ;
109129 } ) ;
110130
111131 it ( "should create deployment indicating ssh keys (detects no interactivity)" , async ( ) => {
0 commit comments