Skip to content

Commit 2943b83

Browse files
committed
fix: drop unnecessary file change for unit test
1 parent 0854322 commit 2943b83

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
exampleTargetexampleCodeexampleCodeexampleCodeexampleCodeexampleCodeexampleCodeexampleCodeexampleCode
1+
exampleTarget

pkg/plugin/util/util_test.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,28 @@ limitations under the License.
1414
package util
1515

1616
import (
17+
"os"
1718
"path/filepath"
1819

1920
. "github.com/onsi/ginkgo/v2"
2021
. "github.com/onsi/gomega"
2122
)
2223

23-
var _ = Describe("InsertCode", func() {
24+
var _ = Describe("InsertCode", Ordered, func() {
2425
path := filepath.Join("testdata", "exampleFile.txt")
26+
var originalContent []byte
27+
28+
BeforeAll(func() {
29+
var err error
30+
originalContent, err = os.ReadFile(path)
31+
Expect(err).NotTo(HaveOccurred())
32+
})
33+
34+
AfterAll(func() {
35+
err := os.WriteFile(path, originalContent, 0644)
36+
Expect(err).NotTo(HaveOccurred())
37+
})
38+
2539
DescribeTable("should not succeed",
2640
func(target string) {
2741
Expect(InsertCode(path, target, "exampleCode")).ShouldNot(Succeed())

0 commit comments

Comments
 (0)