Skip to content

Commit 7c5b2d9

Browse files
Create command_test.go
1 parent cf5dbb3 commit 7c5b2d9

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

pkg/cli/alpha/command_test.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
Copyright 2023 The Kubernetes Authors.
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+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
14+
package alpha
15+
16+
import (
17+
"testing"
18+
19+
. "github.com/onsi/ginkgo/v2"
20+
. "github.com/onsi/gomega"
21+
)
22+
23+
// Figuring out ways to test run these tests similar to existing.
24+
// Currently unable to run without this on VSCode. Will remove once done
25+
func TestCommand(t *testing.T) {
26+
RegisterFailHandler(Fail)
27+
RunSpecs(t, "Command")
28+
}
29+
30+
var _ = Describe("Command", func() {
31+
32+
When("NewScaffoldCommand", func() {
33+
It("Testing the NewScaffoldCommand", func() {
34+
cmd := NewScaffoldCommand()
35+
Expect(cmd).NotTo(BeNil())
36+
Expect(cmd.Use).NotTo(Equal(""))
37+
Expect(cmd.Use).To(ContainSubstring("generate"))
38+
Expect(cmd.Short).NotTo(Equal(""))
39+
Expect(cmd.Short).To(ContainSubstring("Re-scaffold a Kubebuilder project from its PROJECT file"))
40+
Expect(cmd.Example).NotTo(Equal(""))
41+
Expect(cmd.Example).To(ContainSubstring("kubebuilder alpha generate"))
42+
})
43+
})
44+
})

0 commit comments

Comments
 (0)