From 8c55de381869005e61cbc769bce1660404741987 Mon Sep 17 00:00:00 2001 From: Zhou Hao Date: Thu, 2 Apr 2020 13:49:20 +0800 Subject: [PATCH 1/3] add unit test for IsRoot Signed-off-by: Zhou Hao --- pkg/chart/chart_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pkg/chart/chart_test.go b/pkg/chart/chart_test.go index 4f19bf87d..51dc8cb4f 100644 --- a/pkg/chart/chart_test.go +++ b/pkg/chart/chart_test.go @@ -96,3 +96,24 @@ func TestMetadata(t *testing.T) { is.Equal("1.0.0", chrt.AppVersion()) is.Equal(nil, chrt.Validate()) } + +func TestIsRoot(t *testing.T) { + chrt1 := Chart{ + parent: &Chart{ + Metadata: &Metadata{ + Name: "foo", + }, + }, + } + + chrt2 := Chart{ + Metadata: &Metadata{ + Name: "foo", + }, + } + + is := assert.New(t) + + is.Equal(false, chrt1.IsRoot()) + is.Equal(true, chrt2.IsRoot()) +} From a3d3fa396423b82c14fa3c3619eaf03e79ad8884 Mon Sep 17 00:00:00 2001 From: Zhou Hao Date: Thu, 2 Apr 2020 13:58:58 +0800 Subject: [PATCH 2/3] add unit test for ChartPath Signed-off-by: Zhou Hao --- pkg/chart/chart_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pkg/chart/chart_test.go b/pkg/chart/chart_test.go index 51dc8cb4f..6f352adda 100644 --- a/pkg/chart/chart_test.go +++ b/pkg/chart/chart_test.go @@ -117,3 +117,24 @@ func TestIsRoot(t *testing.T) { is.Equal(false, chrt1.IsRoot()) is.Equal(true, chrt2.IsRoot()) } + +func TestChartPath(t *testing.T) { + chrt1 := Chart{ + parent: &Chart{ + Metadata: &Metadata{ + Name: "foo", + }, + }, + } + + chrt2 := Chart{ + Metadata: &Metadata{ + Name: "foo", + }, + } + + is := assert.New(t) + + is.Equal("foo.", chrt1.ChartPath()) + is.Equal("foo", chrt2.ChartPath()) +} From b439d34a43b886ee4f2272e922e03b05ee5e898d Mon Sep 17 00:00:00 2001 From: Zhou Hao Date: Thu, 2 Apr 2020 13:59:37 +0800 Subject: [PATCH 3/3] add unit test for ChartFullPath Signed-off-by: Zhou Hao --- pkg/chart/chart_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pkg/chart/chart_test.go b/pkg/chart/chart_test.go index 6f352adda..1b8669ac8 100644 --- a/pkg/chart/chart_test.go +++ b/pkg/chart/chart_test.go @@ -138,3 +138,24 @@ func TestChartPath(t *testing.T) { is.Equal("foo.", chrt1.ChartPath()) is.Equal("foo", chrt2.ChartPath()) } + +func TestChartFullPath(t *testing.T) { + chrt1 := Chart{ + parent: &Chart{ + Metadata: &Metadata{ + Name: "foo", + }, + }, + } + + chrt2 := Chart{ + Metadata: &Metadata{ + Name: "foo", + }, + } + + is := assert.New(t) + + is.Equal("foo/charts/", chrt1.ChartFullPath()) + is.Equal("foo", chrt2.ChartFullPath()) +}