Skip to content

Commit e75bfde

Browse files
Unit tests for plugins.go (#26)
1 parent 463fb91 commit e75bfde

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

pkg/quarkus/v1alpha/plugin_test.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Copyright 2021 The Operator-SDK Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package v1
16+
17+
import (
18+
. "github.com/onsi/ginkgo"
19+
. "github.com/onsi/gomega"
20+
"sigs.k8s.io/kubebuilder/v3/pkg/config"
21+
v3 "sigs.k8s.io/kubebuilder/v3/pkg/config/v3"
22+
"sigs.k8s.io/kubebuilder/v3/pkg/model/stage"
23+
"sigs.k8s.io/kubebuilder/v3/pkg/plugin"
24+
)
25+
26+
var _ = Describe("v1", func() {
27+
testPlugin := &Plugin{}
28+
29+
Describe("Name", func() {
30+
It("should return the plugin name", func() {
31+
Expect(testPlugin.Name(), "quarkus.javaoperatorsdk.io")
32+
})
33+
})
34+
35+
Describe("Version", func() {
36+
It("should return the plugin version", func() {
37+
Expect(testPlugin.Version(), plugin.Version{Number: 1, Stage: stage.Alpha})
38+
})
39+
})
40+
41+
Describe("SupportedProjectVersions", func() {
42+
It("should return the support project versions", func() {
43+
Expect(testPlugin.Version(), []config.Version{v3.Version})
44+
})
45+
})
46+
47+
Describe("GetInitSubcommand", func() {
48+
It("should return the plugin initSubcommand", func() {
49+
Expect(testPlugin.GetInitSubcommand(), &testPlugin.initSubcommand)
50+
})
51+
})
52+
53+
Describe("GetCreateAPISubcommand", func() {
54+
It("should return the plugin createAPISubcommand", func() {
55+
Expect(testPlugin.GetCreateAPISubcommand(), &testPlugin.createAPISubcommand)
56+
})
57+
})
58+
})

0 commit comments

Comments
 (0)