diff --git a/models/dataset.go b/models/dataset.go index 7684e7ff..42a390dd 100644 --- a/models/dataset.go +++ b/models/dataset.go @@ -31,6 +31,7 @@ const ( CantabularBlob CantabularFlexibleTable CantabularMultivariateTable + Static Invalid ) @@ -41,6 +42,7 @@ var datasetTypes = []string{ "cantabular_blob", "cantabular_flexible_table", "cantabular_multivariate_table", + "static", "invalid", } @@ -63,6 +65,8 @@ func GetDatasetType(datasetType string) (DatasetType, error) { return CantabularFlexibleTable, nil case "cantabular_multivariate_table": return CantabularMultivariateTable, nil + case "static": + return Static, nil default: return Invalid, errs.ErrDatasetTypeInvalid } diff --git a/models/dataset_test.go b/models/dataset_test.go index 61eba628..58b1f41d 100644 --- a/models/dataset_test.go +++ b/models/dataset_test.go @@ -63,7 +63,8 @@ func TestString(t *testing.T) { So(datasetTypes[3], ShouldEqual, "cantabular_blob") So(datasetTypes[4], ShouldEqual, "cantabular_flexible_table") So(datasetTypes[5], ShouldEqual, "cantabular_multivariate_table") - So(datasetTypes[6], ShouldEqual, "invalid") + So(datasetTypes[6], ShouldEqual, "static") + So(datasetTypes[7], ShouldEqual, "invalid") }) }) } @@ -102,6 +103,14 @@ func TestGetDatasetType(t *testing.T) { }) }) + Convey("When the type is static", func() { + Convey("Then it should return the appropriate value", func() { + result, err := GetDatasetType("static") + So(result, ShouldEqual, Static) + So(err, ShouldBeNil) + }) + }) + Convey("When the type is invalid", func() { Convey("Then an error should be returned", func() { result, err := GetDatasetType("abcdefg")