github.com/SupersunnySea/draft@v0.16.0/pkg/draft/pack/list_test.go (about)

     1  package pack
     2  
     3  import (
     4  	"path/filepath"
     5  	"reflect"
     6  	"testing"
     7  )
     8  
     9  func TestListAll(t *testing.T) {
    10  	var (
    11  		packsRoot = filepath.Join("repo", "testdata", "packs")
    12  		want      = []string{
    13  			"github.com/testOrg1/testRepo1/testpack1",
    14  			"github.com/testOrg1/testRepo1/testpack2",
    15  			"github.com/testOrg1/testRepo2/testpack1",
    16  			"github.com/testOrg1/testRepo2/testpack2",
    17  		}
    18  	)
    19  	got, err := List(packsRoot, "")
    20  	if err != nil {
    21  		t.Fatal(err)
    22  	}
    23  	if !reflect.DeepEqual(got, want) {
    24  		t.Fatalf("want: %v\ngot: %v\n", want, got)
    25  	}
    26  }
    27  
    28  func TestListRepo(t *testing.T) {
    29  	const packsRepo = "github.com/testOrg1/testRepo1"
    30  	var (
    31  		packsRoot = filepath.Join("repo", "testdata", "packs")
    32  		want      = []string{
    33  			"github.com/testOrg1/testRepo1/testpack1",
    34  			"github.com/testOrg1/testRepo1/testpack2",
    35  		}
    36  	)
    37  
    38  	got, err := List(packsRoot, packsRepo)
    39  	if err != nil {
    40  		t.Fatal(err)
    41  	}
    42  	if !reflect.DeepEqual(got, want) {
    43  		t.Fatalf("want: %v\ngot: %v\n", want, got)
    44  	}
    45  }