(t *testing.T)
| 107 | } |
| 108 | |
| 109 | func TestDeleteUser(t *testing.T) { |
| 110 | type args struct { |
| 111 | code int |
| 112 | data map[string]string |
| 113 | result string |
| 114 | } |
| 115 | tests := []struct { |
| 116 | name string |
| 117 | args args |
| 118 | }{ |
| 119 | { |
| 120 | name: "normal", |
| 121 | args: args{ |
| 122 | code: http.StatusOK, |
| 123 | data: map[string]string{"id": "1"}, |
| 124 | result: "message", |
| 125 | }, |
| 126 | }, |
| 127 | { |
| 128 | name: "empty", |
| 129 | args: args{ |
| 130 | code: http.StatusOK, |
| 131 | data: map[string]string{"id": ""}, |
| 132 | result: "message", |
| 133 | }, |
| 134 | }, |
| 135 | { |
| 136 | name: "nil", |
| 137 | args: args{ |
| 138 | code: http.StatusOK, |
| 139 | data: nil, |
| 140 | result: "message", |
| 141 | }, |
| 142 | }, |
| 143 | } |
| 144 | for _, tt := range tests { |
| 145 | t.Run(tt.name, func(t *testing.T) { |
| 146 | c, w := utils.NewGinContext() |
| 147 | utils.SetGinRequestParams(c, tt.args.data) |
| 148 | DeleteUser(c) |
| 149 | assert.Equal(t, tt.args.code, w.Code) |
| 150 | assert.Contains(t, w.Body.String(), tt.args.result) |
| 151 | }) |
| 152 | } |
| 153 | } |
nothing calls this directly
no test coverage detected