Skip to content

Commit

Permalink
test: increase coverage for query.go and bulk.go
Browse files Browse the repository at this point in the history
  • Loading branch information
k-capehart committed Jun 17, 2024
1 parent e863397 commit 6b3c6d8
Show file tree
Hide file tree
Showing 4 changed files with 602 additions and 94 deletions.
29 changes: 1 addition & 28 deletions bulk.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,30 +269,6 @@ func mapsToCSV(maps []map[string]any) (string, error) {
return buf.String(), nil
}

func mapsToCSVSlices(maps []map[string]string) ([][]string, error) {
var data [][]string
var headers []string

if len(maps) > 0 {
headers = make([]string, 0, len(maps[0]))
for header := range maps[0] {
headers = append(headers, header)
}
data = append(data, headers)
}

for _, m := range maps {
row := make([]string, 0, len(headers))
for _, header := range headers {
val := m[header]
row = append(row, val)
}
data = append(data, row)
}

return data, nil
}

func readCSVFile(filePath string) ([][]string, error) {
file, fileErr := appFs.Open(filePath)
if fileErr != nil {
Expand Down Expand Up @@ -334,10 +310,7 @@ func constructBulkJobRequest(auth authentication, sObjectName string, operation
Operation: operation,
ExternalIdFieldName: fieldName,
}
body, jsonError := json.Marshal(jobReq)
if jsonError != nil {
return bulkJob{}, jsonError
}
body, _ := json.Marshal(jobReq)

job, jobCreationErr := createBulkJob(auth, ingestJobType, body)
if jobCreationErr != nil {
Expand Down
Loading

0 comments on commit 6b3c6d8

Please sign in to comment.