nic-chen commented on a change in pull request #1315: URL: https://github.com/apache/apisix-dashboard/pull/1315#discussion_r569930306
########## File path: api/internal/handler/route/route_test.go ########## @@ -14,1743 +14,1421 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package route import ( "encoding/json" + "errors" + "fmt" "net/http" "testing" - "time" "github.com/shiningrush/droplet" "github.com/shiningrush/droplet/data" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" - "github.com/apisix/manager-api/internal/conf" "github.com/apisix/manager-api/internal/core/entity" - "github.com/apisix/manager-api/internal/core/storage" "github.com/apisix/manager-api/internal/core/store" + "github.com/apisix/manager-api/internal/handler" + "github.com/apisix/manager-api/internal/utils/consts" ) -func TestRoute(t *testing.T) { - // init - err := storage.InitETCDClient(conf.ETCDConfig) - assert.Nil(t, err) - err = store.InitStores() - assert.Nil(t, err) +type testCase struct { + caseDesc string + giveInput interface{} + mockInput interface{} + mockRet interface{} + mockErr interface{} + wantRet interface{} + wantErr interface{} + called bool + serviceInput string + scriptRet interface{} + scriptErr error + serviceRet interface{} + serviceErr error + upstreamRet interface{} + upstreamErr error +} - handler := &Handler{ - routeStore: store.GetStore(store.HubKeyRoute), - svcStore: store.GetStore(store.HubKeyService), - upstreamStore: store.GetStore(store.HubKeyUpstream), - scriptStore: store.GetStore(store.HubKeyScript), +var DagScript = ` Review comment: we could put these test data to a file in dir `testdata`, this is a issue left over from history ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org