From dcc34e56531da167174c58bb024248fcc753cd01 Mon Sep 17 00:00:00 2001 From: Breno L Date: Wed, 29 Dec 2021 18:11:34 -0300 Subject: [PATCH 1/2] feat: add missing min/max fields to BoardConfigurationColumn --- board.go | 2 ++ board_test.go | 7 +++++++ mocks/board_configuration.json | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/board.go b/board.go index 27516872..7e110ae6 100644 --- a/board.go +++ b/board.go @@ -117,6 +117,8 @@ type BoardConfigurationColumnConfig struct { type BoardConfigurationColumn struct { Name string `json:"name"` Status []BoardConfigurationColumnStatus `json:"statuses"` + Min int `json:"min"` + Max int `json:"max"` } // BoardConfigurationColumnStatus represents a status in the column configuration diff --git a/board_test.go b/board_test.go index 982f29bb..736f816a 100644 --- a/board_test.go +++ b/board_test.go @@ -248,4 +248,11 @@ func TestBoardService_GetBoardConfigoration(t *testing.T) { t.Errorf("Expected 6 columns. go %d", len(boardConfiguration.ColumnConfig.Columns)) } + backlogColumn := boardConfiguration.ColumnConfig.Columns[0] + if backlogColumn.Min != 5 { + t.Errorf("Expected a min of 5 issues in backlog. Got %d", backlogColumn.Min) + } + if backlogColumn.Max != 30 { + t.Errorf("Expected a max of 30 issues in backlog. Got %d", backlogColumn.Max) + } } diff --git a/mocks/board_configuration.json b/mocks/board_configuration.json index 9a4c1ec3..0bb9b3db 100644 --- a/mocks/board_configuration.json +++ b/mocks/board_configuration.json @@ -26,7 +26,9 @@ "id": "10005", "self": "https://test.jira.org/rest/api/2/status/10005" } - ] + ], + "min": 5, + "max": 30 }, { "name": "Selected for development", From f88948c29b61b6398a6a9e973b79df53312f02bc Mon Sep 17 00:00:00 2001 From: Breno L Date: Wed, 29 Dec 2021 19:49:02 -0300 Subject: [PATCH 2/2] fix: add omitempty to min/max in BoardConfigurationColumn --- board.go | 4 ++-- board_test.go | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/board.go b/board.go index 7e110ae6..403d1566 100644 --- a/board.go +++ b/board.go @@ -117,8 +117,8 @@ type BoardConfigurationColumnConfig struct { type BoardConfigurationColumn struct { Name string `json:"name"` Status []BoardConfigurationColumnStatus `json:"statuses"` - Min int `json:"min"` - Max int `json:"max"` + Min int `json:"min,omitempty"` + Max int `json:"max,omitempty"` } // BoardConfigurationColumnStatus represents a status in the column configuration diff --git a/board_test.go b/board_test.go index 736f816a..11a5dc2d 100644 --- a/board_test.go +++ b/board_test.go @@ -255,4 +255,12 @@ func TestBoardService_GetBoardConfigoration(t *testing.T) { if backlogColumn.Max != 30 { t.Errorf("Expected a max of 30 issues in backlog. Got %d", backlogColumn.Max) } + + inProgressColumn := boardConfiguration.ColumnConfig.Columns[2] + if inProgressColumn.Min != 0 { + t.Errorf("Expected a min of 0 issues in progress. Got %d", inProgressColumn.Min) + } + if inProgressColumn.Max != 0 { + t.Errorf("Expected a max of 0 issues in progress. Got %d", inProgressColumn.Max) + } }