Skip to content

Commit

Permalink
Update .gitignore and refactor test suite structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Athul Muralidhar committed Sep 26, 2023
1 parent 8371f48 commit 131a82a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 36 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ go.work
/protoc
/.idea/sonarlint/issuestore/e/3/e3661dc931fae92cdbebb07dae79b6dc0d4b23c7
/.idea/sonarlint/securityhotspotstore/e/3/e3661dc931fae92cdbebb07dae79b6dc0d4b23c7
/.idea/sonarlint/issuestore/a/8/a81b87ba622b933d644c063932316f4f3a59e585
/.idea/sonarlint/issuestore/b/2/b27e432ec96355a0a0d6dcfb9896e10e33a78dba
/.idea/sonarlint/securityhotspotstore/a/8/a81b87ba622b933d644c063932316f4f3a59e585
/.idea/sonarlint/securityhotspotstore/b/2/b27e432ec96355a0a0d6dcfb9896e10e33a78dba
2 changes: 1 addition & 1 deletion cmd/cmd_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmd_test
package cmd

import (
"testing"
Expand Down
61 changes: 26 additions & 35 deletions cmd/unzip/unzip_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package unzip_test
package unzip

import (
"github.com/AthulMuralidhar/protobuff-installer/cmd/downloader"
"go.uber.org/zap"
"os"
"testing"

. "github.com/onsi/ginkgo/v2"
Expand All @@ -12,37 +15,25 @@ func TestUnzip(t *testing.T) {
RunSpecs(t, "Unzip Suite")
}

//func Test_unzipToDir(t *testing.T) {
// g := gomega.NewWithT(t)
// type args struct {
// source string
// dest string
// }
// tests := []struct {
// name string
// args args
// wantErr bool
// }{
// // TODO: make sure that the unzipping happens in the protoc dir
// {
// name: "happy flow",
// args: args{
// source: "",
// dest: "",
// },
// wantErr: false,
// },
// }
//
// err := globalSetup()
// g.Expect(err).ToNot(g.)
//
//
// for _, tt := range tests {
// t.Run(tt.name, func(t *testing.T) {
// if err := UnzipToDir(tt.args.source, tt.args.dest); (err != nil) != tt.wantErr {
// t.Errorf("unzipToDir() error = %v, wantErr %v", err, tt.wantErr)
// }
// })
// }
//}
var _ = Describe("Unzip", func() {
logger, _ := zap.NewProduction()
defer logger.Sync() // flushes buffer, if any
sugar := logger.Sugar()

f, err := downloader.DownloadAndCreateFile(sugar, "https://github.com/protocolbuffers/protobuf/releases/download/v24.2/protoc-24.2-linux-x86_64.zip", "")
Expect(err).ToNot(HaveOccurred())
Expect(f).ToNot(BeNil())

AfterAll(func() {
err := os.Remove(f.Name())
Expect(err).ToNot(HaveOccurred())
})

It("make sure that the unziped file is not empty", func() {
// // TODO: make sure that the unziped file is not empty

})

// // TODO: make sure that the unzipping happens in the protoc dir
// // TODO: make sure that the unziped file is not empty
})

0 comments on commit 131a82a

Please sign in to comment.