(t *testing.T)
| 151 | } |
| 152 | |
| 153 | func TestTemplateVersionParameter_OK(t *testing.T) { |
| 154 | t.Parallel() |
| 155 | req := require.New(t) |
| 156 | |
| 157 | // In this test we're just going to cover the fields that have to get parsed. |
| 158 | options := []*proto.RichParameterOption{ |
| 159 | { |
| 160 | Name: "foo", |
| 161 | Description: "bar", |
| 162 | Value: "baz", |
| 163 | Icon: "David Bowie", |
| 164 | }, |
| 165 | } |
| 166 | ob, err := json.Marshal(&options) |
| 167 | req.NoError(err) |
| 168 | |
| 169 | db := database.TemplateVersionParameter{ |
| 170 | Options: json.RawMessage(ob), |
| 171 | Description: "_The Rise and Fall of **Ziggy Stardust** and the Spiders from Mars_", |
| 172 | } |
| 173 | sdk, err := db2sdk.TemplateVersionParameter(db) |
| 174 | req.NoError(err) |
| 175 | req.Len(sdk.Options, 1) |
| 176 | req.Equal("foo", sdk.Options[0].Name) |
| 177 | req.Equal("bar", sdk.Options[0].Description) |
| 178 | req.Equal("baz", sdk.Options[0].Value) |
| 179 | req.Equal("David Bowie", sdk.Options[0].Icon) |
| 180 | req.Equal("The Rise and Fall of Ziggy Stardust and the Spiders from Mars", sdk.DescriptionPlaintext) |
| 181 | } |
| 182 | |
| 183 | func TestTemplateVersionParameter_BadOptions(t *testing.T) { |
| 184 | t.Parallel() |
nothing calls this directly
no test coverage detected