-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_test.go
More file actions
36 lines (27 loc) · 725 Bytes
/
main_test.go
File metadata and controls
36 lines (27 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"context"
"github.com/magiconair/properties/assert"
"github.com/stretchr/testify/require"
"github.com/vmware-tanzu/octant/pkg/view/component"
"testing"
"github.com/vmware-tanzu/octant/pkg/plugin/service"
)
type fakeRequest struct {}
func (f *fakeRequest) DashboardClient() service.Dashboard {
return nil
}
func (f *fakeRequest) Path() string {
return "/my/fake/path"
}
func (f *fakeRequest) Context() context.Context {
return context.TODO()
}
func Test_routeHandler(t *testing.T) {
p := actionPlugin{}
r := &fakeRequest{}
cr, err := p.routeHandler(r)
require.NoError(t, err)
expectedTitle := component.TitleFromString("Action Example")
assert.Equal(t, cr.Title, expectedTitle)
}