Repository: ctreminiom/go-atlassian
Pull request #285 (2024-07-01 12:38:41)

Added tests for parse request type & fixed test naming


Patch:
diff --git a/pkg/infra/models/errors.go b/pkg/infra/models/errors.go
index 3760499..fe2bdf5 100644
--- a/pkg/infra/models/errors.go
+++ b/pkg/infra/models/errors.go
@@ -161,6 +161,7 @@ var (
 	ErrNoCheckBoxTypeError                 = errors.New("custom-field: no check-box type set")
 	ErrNoCascadingParentError              = errors.New("custom-field: no cascading parent value set")
 	ErrNoCascadingChildError               = errors.New("custom-field: no cascading child value set")
+	ErrNoRequestTypeError                  = errors.New("custom-field: no request type value set")
 	ErrNoTempoAccountTypeError             = errors.New("custom-field: no tempo account value set")
 	ErrNoAttachmentIdsError                = errors.New("sm: no attachment id's set")
 	ErrNoLabelsError                       = errors.New("sm: no label names set")
diff --git a/pkg/infra/models/jira_issue_custom_fields.go b/pkg/infra/models/jira_issue_custom_fields.go
index 359a85c..92f39af 100644
--- a/pkg/infra/models/jira_issue_custom_fields.go
+++ b/pkg/infra/models/jira_issue_custom_fields.go
@@ -1855,12 +1855,12 @@ func ParseRequestTypeCustomField(buffer bytes.Buffer, customField string) (*Cust
 	// Check if the issue iteration contains information on the customfield selected,
 	// if not, continue
 	if raw.Get(path).Type == gjson.Null {
-		return nil, ErrNoAssetTypeError
+		return nil, ErrNoRequestTypeError
 	}
 
 	var requestType *CustomFieldRequestTypeScheme
 	if err := json.Unmarshal([]byte(raw.Get(path).String()), &requestType); err != nil {
-		return nil, ErrNoAssetTypeError
+		return nil, ErrNoRequestTypeError
 	}
 
 	return requestType, nil


Test patch:
diff --git a/pkg/infra/models/jira_issue_custom_fields_test.go b/pkg/infra/models/jira_issue_custom_fields_test.go
index 30e4ba8..8790fba 100644
--- a/pkg/infra/models/jira_issue_custom_fields_test.go
+++ b/pkg/infra/models/jira_issue_custom_fields_test.go
@@ -312,15 +312,15 @@ func TestParseMultiGroupPickerField(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseMultiGroupPickerCustomField(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseMultiGroupPickerCustomField() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseMultiGroupPickerCustomField() got = %v, want %v", got, testCase.want)
 			}
 
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseMultiGroupPickerCustomField() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -538,14 +538,14 @@ func TestParseMultiUserPickerField(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseMultiUserPickerCustomField(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseMultiUserPickerCustomField() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseMultiUserPickerCustomField() got = %v, want %v", got, testCase.want)
 			}
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseMultiUserPickerCustomField() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -691,15 +691,15 @@ func TestParseCascadingSelectField(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseCascadingSelectCustomField(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseCascadingSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseCascadingSelectCustomField() got = %v, want %v", got, testCase.want)
 			}
 
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseCascadingSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -875,15 +875,15 @@ func TestParseMultiVersionCustomField(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseMultiVersionCustomField(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseUserPickerCustomField() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseUserPickerCustomField() got = %v, want %v", got, testCase.want)
 			}
 
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseUserPickerCustomField() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -1037,15 +1037,15 @@ func TestParseUserPickerCustomField(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseUserPickerCustomField(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseUserPickerCustomField() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseUserPickerCustomField() got = %v, want %v", got, testCase.want)
 			}
 
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseUserPickerCustomField() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -1147,15 +1147,15 @@ func TestParseStringCustomField(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseStringCustomField(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseStringCustomField() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseStringCustomField() got = %v, want %v", got, testCase.want)
 			}
 
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseStringCustomField() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -1254,15 +1254,15 @@ func TestParseDatePickerCustomField(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseDatePickerCustomField(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseDatePickerCustomField() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseDatePickerCustomField() got = %v, want %v", got, testCase.want)
 			}
 
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseDatePickerCustomField() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -1366,15 +1366,15 @@ func TestParseDateTimeCustomField(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseDateTimeCustomField(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseDateTimeCustomField() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseDateTimeCustomField() got = %v, want %v", got, testCase.want)
 			}
 
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseDateTimeCustomField() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -1487,15 +1487,15 @@ func TestParseFloatCustomField(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseFloatCustomField(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseFloatCustomField() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseFloatCustomField() got = %v, want %v", got, testCase.want)
 			}
 
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseFloatCustomField() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -1614,15 +1614,15 @@ func TestParseLabelCustomField(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseLabelCustomField(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseLabelCustomField() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseLabelCustomField() got = %v, want %v", got, testCase.want)
 			}
 
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseLabelCustomField() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -1771,14 +1771,14 @@ func TestParseSprintCustomField(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseSprintCustomField(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseSprintCustomField() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseSprintCustomField() got = %v, want %v", got, testCase.want)
 			}
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseSprintCustomField() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -2042,14 +2042,220 @@ func TestParseAssetCustomField(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseAssetCustomField(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseAssetCustomField() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseAssetCustomField() got = %v, want %v", got, testCase.want)
 			}
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseAssetCustomField() got = (%v), want (%v)", err, testCase.Err)
+			}
+		})
+	}
+}
+
+func TestParseRequestTypeCustomField(t *testing.T) {
+	bufferMocked := bytes.Buffer{}
+	bufferMocked.WriteString(`
+{
+  "fields": {
+    "customfield_10010": {
+      "_links": {
+        "jiraRest": "https://mydomain.atlassian.net/rest/api/2/issue/144906",
+        "web": "https://mydomain.atlassian.net/servicedesk/customer/portal/2/ESD-40928",
+        "self": "https://mydomain.atlassian.net/rest/servicedeskapi/request/144906",
+        "agent": "https://mydomain.atlassian.net/browse/ESD-40928"
+      },
+      "requestType": {
+        "_expands": [
+          "field"
+        ],
+        "id": "96",
+        "_links": {
+          "self": "https://mydomain.atlassian.net/rest/servicedeskapi/servicedesk/2/requesttype/96"
+        },
+        "name": "General Service Request",
+        "description": "",
+        "helpText": "",
+        "issueTypeId": "10039",
+        "serviceDeskId": "2",
+        "portalId": "2",
+        "groupIds": [],
+        "icon": {
+          "id": "10466",
+          "_links": {
+            "iconUrls": {
+              "48x48": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=large",
+              "24x24": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=small",
+              "16x16": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=xsmall",
+              "32x32": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=medium"
+            }
+          }
+        }
+      },
+      "currentStatus": {
+        "status": "Check billing account",
+        "statusCategory": "NEW",
+        "statusDate": {
+          "iso8601": "2024-06-28T15:33:57+0900",
+          "jira": "2024-06-28T08:33:57.313+0200",
+          "friendly": "Friday 15:33",
+          "epochMillis": 1719556437313
+        }
+      }
+    }
+  }
+}`)
+
+	bufferMockedWithNoFields := bytes.Buffer{}
+	bufferMockedWithNoFields.WriteString(`
+{
+  "no_fields": {
+    "customfield_10010": {
+      "_links": {
+        "jiraRest": "https://mydomain.atlassian.net/rest/api/2/issue/144906",
+        "web": "https://mydomain.atlassian.net/servicedesk/customer/portal/2/ESD-40928",
+        "self": "https://mydomain.atlassian.net/rest/servicedeskapi/request/144906",
+        "agent": "https://mydomain.atlassian.net/browse/ESD-40928"
+      },
+      "requestType": {
+        "_expands": [
+          "field"
+        ],
+        "id": "96",
+        "_links": {
+          "self": "https://mydomain.atlassian.net/rest/servicedeskapi/servicedesk/2/requesttype/96"
+        },
+        "name": "General Service Request",
+        "description": "",
+        "helpText": "",
+        "issueTypeId": "10039",
+        "serviceDeskId": "2",
+        "portalId": "2",
+        "groupIds": [],
+        "icon": {
+          "id": "10466",
+          "_links": {
+            "iconUrls": {
+              "48x48": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=large",
+              "24x24": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=small",
+              "16x16": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=xsmall",
+              "32x32": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=medium"
+            }
+          }
+        }
+      },
+      "currentStatus": {
+        "status": "Check billing account",
+        "statusCategory": "NEW",
+        "statusDate": {
+          "iso8601": "2024-06-28T15:33:57+0900",
+          "jira": "2024-06-28T08:33:57.313+0200",
+          "friendly": "Friday 15:33",
+          "epochMillis": 1719556437313
+        }
+      }
+    }
+  }
+}`)
+
+	bufferMockedWithWrongType := bytes.Buffer{}
+	bufferMockedWithWrongType.WriteString(`
+{
+  "fields": {
+    "customfield_10010": ""
+  }
+}`)
+
+	type args struct {
+		buffer      bytes.Buffer
+		customField string
+	}
+	tests := []struct {
+		name    string
+		args    args
+		want    *CustomFieldRequestTypeScheme
+		wantErr bool
+		Err     error
+	}{
+		{
+			name: "when the buffer contains information",
+			args: args{
+				buffer:      bufferMocked,
+				customField: "customfield_10010",
+			},
+			want: &CustomFieldRequestTypeScheme{
+				Links: &CustomFieldRequestTypeLinkScheme{
+					JiraRest: "https://mydomain.atlassian.net/rest/api/2/issue/144906",
+					Web:      "https://mydomain.atlassian.net/servicedesk/customer/portal/2/ESD-40928",
+					Self:     "https://mydomain.atlassian.net/rest/servicedeskapi/request/144906",
+					Agent:    "https://mydomain.atlassian.net/browse/ESD-40928",
+				},
+				RequestType: &CustomerRequestTypeScheme{
+					ID:            "96",
+					Name:          "General Service Request",
+					Description:   "",
+					HelpText:      "",
+					IssueTypeID:   "10039",
+					ServiceDeskID: "2",
+					GroupIds:      []string{},
+				},
+				CurrentStatus: &CustomerRequestCurrentStatusScheme{
+					Status:         "Check billing account",
+					StatusCategory: "NEW",
+					StatusDate: &CustomerRequestCurrentStatusDateScheme{
+						Iso8601:     "2024-06-28T15:33:57+0900",
+						Jira:        "2024-06-28T08:33:57.313+0200",
+						Friendly:    "Friday 15:33",
+						EpochMillis: 1719556437313,
+					},
+				},
+			},
+		},
+		{
+			name: "when the buffer contains no custom field",
+			args: args{
+				buffer:      bufferMocked,
+				customField: "customfield_10020",
+			},
+			want:    nil,
+			wantErr: true,
+			Err:     ErrNoRequestTypeError,
+		},
+		{
+			name: "when the buffer contains no fields",
+			args: args{
+				buffer:      bufferMockedWithNoFields,
+				customField: "customfield_10010",
+			},
+			want:    nil,
+			wantErr: true,
+			Err:     ErrNoFieldInformationError,
+		},
+		{
+			name: "when the buffer contains wrong type",
+			args: args{
+				buffer:      bufferMockedWithWrongType,
+				customField: "customfield_10010",
+			},
+			want:    nil,
+			wantErr: true,
+			Err:     ErrNoRequestTypeError,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			got, err := ParseRequestTypeCustomField(tt.args.buffer, tt.args.customField)
+			if (err != nil) != tt.wantErr {
+				t.Errorf("ParseRequestTypeCustomField() error = %v, wantErr %v", err, tt.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, tt.want) {
+				t.Errorf("ParseRequestTypeCustomField() got = %v, want %v", got, tt.want)
+			}
+			if !reflect.DeepEqual(err, tt.Err) {
+				t.Errorf("ParseRequestTypeCustomField() got = (%v), want (%v)", err, tt.Err)
 			}
 		})
 	}
@@ -2226,14 +2432,14 @@ func TestParseMultiSelectCustomFields(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseMultiSelectCustomFields(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseMultiSelectCustomFields() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseMultiSelectCustomFields() got = %v, want %v", got, testCase.want)
 			}
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseMultiSelectCustomFields() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -2530,14 +2736,14 @@ func TestParseMultiGroupPickerCustomFields(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseMultiGroupPickerCustomFields(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseMultiGroupPickerCustomFields() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseMultiGroupPickerCustomFields() got = %v, want %v", got, testCase.want)
 			}
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseMultiGroupPickerCustomFields() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -3028,14 +3234,14 @@ func TestParseMultiUserPickerCustomFields(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseMultiUserPickerCustomFields(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseMultiUserPickerCustomFields() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseMultiUserPickerCustomFields() got = %v, want %v", got, testCase.want)
 			}
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseMultiUserPickerCustomFields() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -3343,14 +3549,14 @@ func TestParseCascadingCustomFields(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseCascadingCustomFields(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseCascadingCustomFields() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseCascadingCustomFields() got = %v, want %v", got, testCase.want)
 			}
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseCascadingCustomFields() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -3674,14 +3880,14 @@ func TestParseMultiVersionCustomFields(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseMultiVersionCustomFields(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseMultiVersionCustomFields() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseMultiVersionCustomFields() got = %v, want %v", got, testCase.want)
 			}
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseMultiVersionCustomFields() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -4001,14 +4207,14 @@ func TestParseUserPickerCustomFields(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseUserPickerCustomFields(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseUserPickerCustomFields() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseUserPickerCustomFields() got = %v, want %v", got, testCase.want)
 			}
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseUserPickerCustomFields() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -4266,10 +4472,10 @@ func TestParseStringCustomFields(t *testing.T) {
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseStringCustomFields() got = %v, want %v", got, testCase.want)
 			}
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseStringCustomFields() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -4527,10 +4733,10 @@ func TestParseFloatCustomFields(t *testing.T) {
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseFloatCustomFields() got = %v, want %v", got, testCase.want)
 			}
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseFloatCustomFields() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -5622,14 +5828,14 @@ func TestParseAssetCustomFields(t *testing.T) {
 		t.Run(testCase.name, func(t *testing.T) {
 			got, err := ParseAssetCustomFields(testCase.args.buffer, testCase.args.customField)
 			if (err != nil) != testCase.wantErr {
-				t.Errorf("ParseMultiSelectCustomField() error = %v, wantErr %v", err, testCase.wantErr)
+				t.Errorf("ParseAssetCustomFields() error = %v, wantErr %v", err, testCase.wantErr)
 				return
 			}
 			if !reflect.DeepEqual(got, testCase.want) {
-				t.Errorf("ParseMultiSelectCustomField() got = %v, want %v", got, testCase.want)
+				t.Errorf("ParseAssetCustomFields() got = %v, want %v", got, testCase.want)
 			}
 			if !reflect.DeepEqual(err, testCase.Err) {
-				t.Errorf("ParseMultiSelectCustomField() got = (%v), want (%v)", err, testCase.Err)
+				t.Errorf("ParseAssetCustomFields() got = (%v), want (%v)", err, testCase.Err)
 			}
 		})
 	}
@@ -6071,3 +6277,331 @@ func TestParseDateTimeCustomFields(t *testing.T) {
 		})
 	}
 }
+
+func TestParseRequestTypeCustomFields(t *testing.T) {
+	bufferMocked := bytes.Buffer{}
+	bufferMocked.WriteString(`
+{
+  "expand": "names,schema",
+  "startAt": 0,
+  "maxResults": 50,
+  "total": 1,
+  "issues": [
+    {
+      "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
+      "id": "10035",
+      "self": "https://ctreminiom.atlassian.net/rest/api/2/issue/10035",
+      "key": "KP-22",
+      "fields": {
+        "customfield_10010": {
+          "_links": {
+            "jiraRest": "https://mydomain.atlassian.net/rest/api/2/issue/144906",
+            "web": "https://mydomain.atlassian.net/servicedesk/customer/portal/2/ESD-40928",
+            "self": "https://mydomain.atlassian.net/rest/servicedeskapi/request/144906",
+            "agent": "https://mydomain.atlassian.net/browse/ESD-40928"
+          },
+          "requestType": {
+            "_expands": [
+              "field"
+            ],
+            "id": "96",
+            "_links": {
+              "self": "https://mydomain.atlassian.net/rest/servicedeskapi/servicedesk/2/requesttype/96"
+            },
+            "name": "General Service Request",
+            "description": "",
+            "helpText": "",
+            "issueTypeId": "10039",
+            "serviceDeskId": "2",
+            "portalId": "2",
+            "groupIds": [],
+            "icon": {
+              "id": "10466",
+              "_links": {
+                "iconUrls": {
+                  "48x48": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=large",
+                  "24x24": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=small",
+                  "16x16": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=xsmall",
+                  "32x32": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=medium"
+                }
+              }
+            }
+          },
+          "currentStatus": {
+            "status": "Check billing account",
+            "statusCategory": "NEW",
+            "statusDate": {
+              "iso8601": "2024-06-28T15:33:57+0900",
+              "jira": "2024-06-28T08:33:57.313+0200",
+              "friendly": "Friday 15:33",
+              "epochMillis": 1719556437313
+            }
+          }
+        }
+      }
+    },
+    {
+      "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
+      "id": "10035",
+      "self": "https://ctreminiom.atlassian.net/rest/api/2/issue/10035",
+      "key": "KP-23",
+      "fields": {
+        "customfield_10010": {
+          "_links": {
+            "jiraRest": "https://mydomain.atlassian.net/rest/api/2/issue/144906",
+            "web": "https://mydomain.atlassian.net/servicedesk/customer/portal/2/ESD-40928",
+            "self": "https://mydomain.atlassian.net/rest/servicedeskapi/request/144906",
+            "agent": "https://mydomain.atlassian.net/browse/ESD-40928"
+          },
+          "requestType": {
+            "_expands": [
+              "field"
+            ],
+            "id": "96",
+            "_links": {
+              "self": "https://mydomain.atlassian.net/rest/servicedeskapi/servicedesk/2/requesttype/96"
+            },
+            "name": "General Service Request",
+            "description": "",
+            "helpText": "",
+            "issueTypeId": "10039",
+            "serviceDeskId": "2",
+            "portalId": "2",
+            "groupIds": [],
+            "icon": {
+              "id": "10466",
+              "_links": {
+                "iconUrls": {
+                  "48x48": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=large",
+                  "24x24": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=small",
+                  "16x16": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=xsmall",
+                  "32x32": "https://mydomain.atlassian.net/rest/api/2/universal_avatar/view/type/SD_REQTYPE/avatar/10466?size=medium"
+                }
+              }
+            }
+          },
+          "currentStatus": {
+            "status": "Check billing account",
+            "statusCategory": "NEW",
+            "statusDate": {
+              "iso8601": "2024-06-28T15:33:57+0900",
+              "jira": "2024-06-28T08:33:57.313+0200",
+              "friendly": "Friday 15:33",
+              "epochMillis": 1719556437313
+            }
+          }
+        }
+      }
+    }
+  ]
+}
+`)
+
+	bufferMockedWithNoIssues := bytes.Buffer{}
+	bufferMockedWithNoIssues.WriteString(`
+{
+  "expand": "names,schema",
+  "startAt": 0,
+  "maxResults": 50,
+  "total": 1,
+  "no_issues": [
+    {
+      "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
+      "id": "10035",
+      "self": "https://ctreminiom.atlassian.net/rest/api/2/issue/10035",
+      "key": "KP-22",
+      "fields": {
+        "customfield_10010": {}
+      }
+    },
+    {
+      "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
+      "id": "10035",
+      "self": "https://ctreminiom.atlassian.net/rest/api/2/issue/10035",
+      "key": "KP-23",
+      "fields": {
+        "customfield_10010": {}
+      }
+    }
+  ]
+}`)
+
+	bufferMockedWithNoFields := bytes.Buffer{}
+	bufferMockedWithNoFields.WriteString(`
+{
+  "expand": "names,schema",
+  "startAt": 0,
+  "maxResults": 50,
+  "total": 1,
+  "issues": [
+    {
+      "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
+      "id": "10035",
+      "self": "https://ctreminiom.atlassian.net/rest/api/2/issue/10035",
+      "key": "KP-22",
+      "no_fields": {
+        "customfield_10010": {}
+      }
+    },
+    {
+      "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
+      "id": "10035",
+      "self": "https://ctreminiom.atlassian.net/rest/api/2/issue/10035",
+      "key": "KP-23",
+      "no_fields": {
+        "customfield_10010": {}
+      }
+    }
+  ]
+}`)
+
+	bufferMockedWithInvalidTypes := bytes.Buffer{}
+	bufferMockedWithInvalidTypes.WriteString(`
+{
+   "expand":"names,schema",
+   "startAt":0,
+   "maxResults":50,
+   "total":1,
+   "issues":[
+      {
+         "expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields",
+         "id":"10035",
+         "self":"https://ctreminiom.atlassian.net/rest/api/2/issue/10035",
+         "key":"KP-22",
+         "fields":{
+            "customfield_10010": 33030303,
+         }
+      },
+      {
+         "expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields",
+         "id":"10035",
+         "self":"https://ctreminiom.atlassian.net/rest/api/2/issue/10035",
+         "key":"KP-23",
+         "fields":{
+            "customfield_10010": true
+         }
+      }
+   ]
+}
+`)
+
+	type args struct {
+		buffer      bytes.Buffer
+		customField string
+	}
+	tests := []struct {
+		name    string
+		args    args
+		want    map[string]*CustomFieldRequestTypeScheme
+		wantErr bool
+		Err     error
+	}{
+		{
+			name: "when the buffer contains information",
+			args: args{
+				buffer:      bufferMocked,
+				customField: "customfield_10010",
+			},
+			want: map[string]*CustomFieldRequestTypeScheme{
+				"KP-22": {
+					Links: &CustomFieldRequestTypeLinkScheme{
+						JiraRest: "https://mydomain.atlassian.net/rest/api/2/issue/144906",
+						Web:      "https://mydomain.atlassian.net/servicedesk/customer/portal/2/ESD-40928",
+						Self:     "https://mydomain.atlassian.net/rest/servicedeskapi/request/144906",
+						Agent:    "https://mydomain.atlassian.net/browse/ESD-40928",
+					},
+					RequestType: &CustomerRequestTypeScheme{
+						ID:            "96",
+						Name:          "General Service Request",
+						Description:   "",
+						HelpText:      "",
+						IssueTypeID:   "10039",
+						ServiceDeskID: "2",
+						GroupIds:      []string{},
+					},
+					CurrentStatus: &CustomerRequestCurrentStatusScheme{
+						Status:         "Check billing account",
+						StatusCategory: "NEW",
+						StatusDate: &CustomerRequestCurrentStatusDateScheme{
+							Iso8601:     "2024-06-28T15:33:57+0900",
+							Jira:        "2024-06-28T08:33:57.313+0200",
+							Friendly:    "Friday 15:33",
+							EpochMillis: 1719556437313,
+						},
+					},
+				},
+				"KP-23": {
+					Links: &CustomFieldRequestTypeLinkScheme{
+						JiraRest: "https://mydomain.atlassian.net/rest/api/2/issue/144906",
+						Web:      "https://mydomain.atlassian.net/servicedesk/customer/portal/2/ESD-40928",
+						Self:     "https://mydomain.atlassian.net/rest/servicedeskapi/request/144906",
+						Agent:    "https://mydomain.atlassian.net/browse/ESD-40928",
+					},
+					RequestType: &CustomerRequestTypeScheme{
+						ID:            "96",
+						Name:          "General Service Request",
+						Description:   "",
+						HelpText:      "",
+						IssueTypeID:   "10039",
+						ServiceDeskID: "2",
+						GroupIds:      []string{},
+					},
+					CurrentStatus: &CustomerRequestCurrentStatusScheme{
+						Status:         "Check billing account",
+						StatusCategory: "NEW",
+						StatusDate: &CustomerRequestCurrentStatusDateScheme{
+							Iso8601:     "2024-06-28T15:33:57+0900",
+							Jira:        "2024-06-28T08:33:57.313+0200",
+							Friendly:    "Friday 15:33",
+							EpochMillis: 1719556437313,
+						},
+					},
+				},
+			},
+
+			wantErr: false,
+		},
+		{
+			name: "when the buffer does not contain the issues object",
+			args: args{
+				buffer:      bufferMockedWithNoIssues,
+				customField: "customfield_10010",
+			},
+			wantErr: true,
+			Err:     ErrNoIssuesSliceError,
+		},
+		{
+			name: "when the buffer does not contain the fields object",
+			args: args{
+				buffer:      bufferMockedWithNoFields,
+				customField: "customfield_10010",
+			},
+			wantErr: true,
+			Err:     ErrNoMapValuesError,
+		},
+		{
+			name: "when the buffer contains invalid types",
+			args: args{
+				buffer:      bufferMockedWithInvalidTypes,
+				customField: "customfield_10010",
+			},
+			wantErr: true,
+			Err:     ErrNoMapValuesError,
+		},
+	}
+	for _, testCase := range tests {
+		t.Run(testCase.name, func(t *testing.T) {
+			got, err := ParseRequestTypeCustomFields(testCase.args.buffer, testCase.args.customField)
+			if (err != nil) != testCase.wantErr {
+				t.Errorf("ParseRequestTypeCustomFields() error = %v, wantErr %v", err, testCase.wantErr)
+				return
+			}
+			if !reflect.DeepEqual(got, testCase.want) {
+				t.Errorf("ParseRequestTypeCustomFields() got = %v, want %v", got, testCase.want)
+			}
+			if !reflect.DeepEqual(err, testCase.Err) {
+				t.Errorf("ParseRequestTypeCustomFields() got = (%v), want (%v)", err, testCase.Err)
+			}
+		})
+	}
+}