@@ -848,11 +848,6 @@ func TestFetchWhiteboardNodes_InvalidResponseTypedError(t *testing.T) {
848848 token string
849849 data map [string ]interface {}
850850 }{
851- {
852- name : "missing nodes" ,
853- token : "test-token-missing-nodes" ,
854- data : map [string ]interface {}{},
855- },
856851 {
857852 name : "nodes not array" ,
858853 token : "test-token-bad-nodes" ,
@@ -880,6 +875,32 @@ func TestFetchWhiteboardNodes_InvalidResponseTypedError(t *testing.T) {
880875 }
881876}
882877
878+ // TestFetchWhiteboardNodes_MissingNodesIsEmpty verifies that a response with
879+ // missing nodes field is treated as an empty whiteboard (success), not an error.
880+ // This matches the behavior introduced in commit 4b39b037.
881+ func TestFetchWhiteboardNodes_MissingNodesIsEmpty (t * testing.T ) {
882+ factory , stdout , reg := newExecuteFactory (t )
883+
884+ reg .Register (& httpmock.Stub {
885+ Method : "GET" ,
886+ URL : "/open-apis/board/v1/whiteboards/test-token-missing-nodes/nodes" ,
887+ Body : map [string ]interface {}{
888+ "code" : 0 ,
889+ "msg" : "success" ,
890+ "data" : map [string ]interface {}{},
891+ },
892+ })
893+
894+ args := []string {"+query" , "--whiteboard-token" , "test-token-missing-nodes" , "--output_as" , "raw" }
895+ if err := runShortcut (t , WhiteboardQuery , args , factory , stdout ); err != nil {
896+ t .Fatalf ("expected success for missing nodes (empty whiteboard), got err=%v" , err )
897+ }
898+
899+ if ! strings .Contains (stdout .String (), "whiteboard is empty" ) {
900+ t .Fatalf ("stdout missing empty whiteboard message: %s" , stdout .String ())
901+ }
902+ }
903+
883904func assertInvalidResponse (t * testing.T , err error ) {
884905 t .Helper ()
885906 if err == nil {
0 commit comments