Skip to content

Commit

Permalink
test of partial file without batch header
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbornsteinMOOV committed Oct 2, 2023
1 parent 6e9cc98 commit 1588c36
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
21 changes: 15 additions & 6 deletions internal/test/download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"net/http"
"os"
"path/filepath"
"sort"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -164,6 +165,10 @@ func TestODFIDownload(t *testing.T) {
require.NoError(t, err)
err = os.WriteFile(emptyFilepath, buf.Bytes(), info.Mode())
require.NoError(t, err)
info, err = os.Stat(filepath.Join(filepath.Dir(emptyFilepath), "ppd-debit-bad.ach"))
require.NoError(t, err)
err = os.WriteFile(emptyFilepath, buf.Bytes(), info.Mode())
require.NoError(t, err)
// Fix permissions to allow deleting files on CI
if os.Getenv("GITHUB_ACTIONS") != "" {
err = os.Chmod(filepath.Dir(emptyFilepath), 0777)
Expand Down Expand Up @@ -232,11 +237,14 @@ func TestODFIDownload(t *testing.T) {
}

// Verify Reconciliations
assert.Len(t, reconciliations, 1)
if len(reconciliations) > 0 {
assert.Equal(t, "ppd-debit.ach", reconciliations[0].Filename)
assert.Len(t, reconciliations[0].Reconciliations, 1)
}
require.Len(t, reconciliations, 2)
sort.Slice(reconciliations, func(i, j int) bool {
return reconciliations[i].Filename < reconciliations[j].Filename
})
assert.Equal(t, "ppd-debit-bad.ach", reconciliations[0].Filename)
require.Len(t, reconciliations[0].Reconciliations, 2)
assert.Equal(t, "ppd-debit.ach", reconciliations[1].Filename)
require.Len(t, reconciliations[1].Reconciliations, 1)

// Verify Returns
assert.Len(t, returns, 1)
Expand All @@ -258,7 +266,7 @@ func TestODFIDownload(t *testing.T) {
require.NoError(t, err)
containsFilepaths(t, filenames, []string{
"/inbound/cor-c01.ach", "/inbound/iat-credit.ach",
"/reconciliation/empty.txt", "/reconciliation/ppd-debit.ach",
"/reconciliation/empty.txt", "/reconciliation/ppd-debit.ach", "/reconciliation/ppd-debit-bad.ach",
"/returned/return-WEB.ach",
})

Expand All @@ -279,6 +287,7 @@ func TestODFIDownload(t *testing.T) {
fmt.Sprintf("/odfi/127.0.0.1:2222/inbound/%s/cor-c01.ach", yymmdd),
fmt.Sprintf("/odfi/127.0.0.1:2222/inbound/%s/iat-credit.ach", yymmdd),
fmt.Sprintf("/odfi/127.0.0.1:2222/reconciliation/%s/ppd-debit.ach", yymmdd),
fmt.Sprintf("/odfi/127.0.0.1:2222/reconciliation/%s/ppd-debit-bad.ach", yymmdd),
fmt.Sprintf("/odfi/127.0.0.1:2222/returned/%s/return-WEB.ach", yymmdd),
})

Expand Down
7 changes: 7 additions & 0 deletions testdata/download-test/reconciliation/ppd-debit-bad.ach
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
5200Adam Shannon MOOVYYYYYYPPDtest trans2005262005271491273976360000188
62627397636915XXXXXXXXXX1 0000000146ae1300b1c1cac5cVeridian Credit Union te1273976361273620
82000000010027397636000000000146000000000000MOOVYYYYYY 273976360000188
6212739763691XXXXXXXXXXX2 0000000008dcd5f1ce42ae2e1Adam Shannon ac1323274270765782
6212739763691XXXXXXXXXXX2 0000000019908ac8a237911d6Adam Shannon ac1323274270765783
6212739763691XXXXXXXXXXX2 0000000019908ac8a237911d6Adam Shannon ac1323274270765784
82000000030082192908000000000000000000000046MOOVYYYYYY 323274270000085

0 comments on commit 1588c36

Please sign in to comment.