mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-04-23 12:08:51 +02:00
Add a test case for the "option" field type
This commit is contained in:
parent
967e2d4805
commit
dda28f9b9c
@ -894,6 +894,42 @@ func TestInitIssueWithMetaAndFields_PriorityValueType(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestInitIssueWithMetaAndFields_SelectList(t *testing.T) {
|
||||
metaProject := MetaProject{
|
||||
Name: "Engineering - Dept",
|
||||
Id: "ENG",
|
||||
}
|
||||
|
||||
fields := tcontainer.NewMarshalMap()
|
||||
fields["someitem"] = map[string]interface{}{
|
||||
"name": "A Select Item",
|
||||
"schema": map[string]interface{}{
|
||||
"type": "option",
|
||||
},
|
||||
}
|
||||
|
||||
metaIssueType := MetaIssueType{
|
||||
Fields: fields,
|
||||
}
|
||||
|
||||
expectedVal := "Value"
|
||||
fieldConfig := map[string]string{
|
||||
"A Select Item": expectedVal,
|
||||
}
|
||||
|
||||
issue, err := InitIssueWithMetaAndFields(&metaProject, &metaIssueType, fieldConfig)
|
||||
if err != nil {
|
||||
t.Errorf("Expected nil error, recieved %s", err)
|
||||
}
|
||||
|
||||
a, _ := issue.Fields.Unknowns.Value("someitem")
|
||||
gotVal := a.(Option).Value
|
||||
|
||||
if gotVal != expectedVal {
|
||||
t.Errorf("Expected %s recieved %s", expectedVal, gotVal)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInitIssueWithMetaAndFields_IssuetypeValueType(t *testing.T) {
|
||||
metaProject := MetaProject{
|
||||
Name: "Engineering - Dept",
|
||||
|
Loading…
x
Reference in New Issue
Block a user