@@ -37,8 +37,10 @@ func TestHandleGetAvailableAPIResources(t *testing.T) {
3737
3838 t .Run ("success" , func (t * testing.T ) {
3939 mock := cmd .NewMockShellExecutor ()
40- expectedOutput := `[{"name": "pods", "singularName": "pod", "namespaced": true, "kind": "Pod"}]`
41- mock .AddCommandString ("kubectl" , []string {"api-resources" , "-o" , "json" }, expectedOutput , nil )
40+ expectedOutput := `NAME SHORTNAMES APIVERSION NAMESPACED KIND
41+ pods po v1 true Pod
42+ services svc v1 true Service`
43+ mock .AddCommandString ("kubectl" , []string {"api-resources" }, expectedOutput , nil )
4244 ctx := cmd .WithShellExecutor (ctx , mock )
4345
4446 k8sTool := newTestK8sTool ()
@@ -56,7 +58,7 @@ func TestHandleGetAvailableAPIResources(t *testing.T) {
5658
5759 t .Run ("kubectl command failure" , func (t * testing.T ) {
5860 mock := cmd .NewMockShellExecutor ()
59- mock .AddCommandString ("kubectl" , []string {"api-resources" , "-o" , "json" }, "" , assert .AnError )
61+ mock .AddCommandString ("kubectl" , []string {"api-resources" }, "" , assert .AnError )
6062 ctx := cmd .WithShellExecutor (ctx , mock )
6163
6264 k8sTool := newTestK8sTool ()
@@ -408,8 +410,8 @@ func TestHandleKubectlGetEnhanced(t *testing.T) {
408410
409411 t .Run ("valid resource_type" , func (t * testing.T ) {
410412 mock := cmd .NewMockShellExecutor ()
411- expectedOutput := `{"items": [{"metadata": {"name": "pod1"}}]} `
412- mock .AddCommandString ("kubectl" , []string {"get" , "pods" , "-o" , "json " }, expectedOutput , nil )
413+ expectedOutput := `NAME READY STATUS RESTARTS AGE `
414+ mock .AddCommandString ("kubectl" , []string {"get" , "pods" , "-o" , "wide " }, expectedOutput , nil )
413415 ctx := cmd .WithShellExecutor (ctx , mock )
414416
415417 k8sTool := newTestK8sTool ()
0 commit comments