2021-06-29 15:00:02 -06:00
|
|
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
2022-11-27 11:20:29 -07:00
|
|
|
// SPDX-License-Identifier: MIT
|
2021-06-29 15:00:02 -06:00
|
|
|
|
|
|
|
package install
|
|
|
|
|
|
|
|
import (
|
2022-08-28 03:43:25 -06:00
|
|
|
"context"
|
2021-06-29 15:00:02 -06:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestRoutes(t *testing.T) {
|
2023-04-27 00:06:45 -06:00
|
|
|
// TODO: this test seems not really testing the handlers
|
2022-08-28 03:43:25 -06:00
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
defer cancel()
|
2023-04-27 00:06:45 -06:00
|
|
|
base := Routes(ctx)
|
|
|
|
assert.NotNil(t, base)
|
|
|
|
r := base.R.Routes()[1]
|
|
|
|
routes := r.SubRoutes.Routes()[0]
|
|
|
|
assert.EqualValues(t, "/", routes.Pattern)
|
|
|
|
assert.Nil(t, routes.SubRoutes)
|
|
|
|
assert.Len(t, routes.Handlers, 2)
|
2021-06-29 15:00:02 -06:00
|
|
|
}
|