Skip to content

Commit

Permalink
add additional assertions on timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbornsteinMOOV committed Aug 2, 2023
1 parent 174808b commit cece2cc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/response/file_transformer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ func TestFileTransformer(t *testing.T) {
require.Len(t, fds, 1)
found, _ := ach.ReadFile(filepath.Join(recondir, fds[0].Name()))
require.Equal(t, matchEntry1.IndividualName, strings.Trim(found.Batches[0].GetEntries()[0].IndividualName, " "))

// verify the timestamp on the file is in the past
fInfo, err := fds[0].Info()
require.NoError(t, err)
require.Less(t, fInfo.ModTime(), time.Now())
})

t.Run("ProcessOnly - Return", func(t *testing.T) {
Expand Down Expand Up @@ -127,6 +132,11 @@ func TestFileTransformer(t *testing.T) {
require.NoError(t, err)
require.Equal(t, "R03", found.Batches[0].GetEntries()[0].Addenda99.ReturnCode)

// verify the timestamp on the file is in the past
fInfo, err := fds[0].Info()
require.NoError(t, err)
require.Less(t, fInfo.ModTime(), time.Now())

// verify no "reconciliation" files created
recondir := filepath.Join(dir, "reconciliation")
_, err = os.ReadDir(recondir)
Expand Down Expand Up @@ -158,6 +168,11 @@ func TestFileTransformer(t *testing.T) {
require.NoError(t, err)
require.Equal(t, "C01", found.Batches[0].GetEntries()[0].Addenda98.ChangeCode)

// verify the timestamp on the file is in the past
fInfo, err := fds[0].Info()
require.NoError(t, err)
require.Less(t, fInfo.ModTime(), time.Now())

// verify no "reconciliation" files created
recondir := filepath.Join(dir, "reconciliation")
_, err = os.ReadDir(recondir)
Expand Down Expand Up @@ -274,6 +289,11 @@ func TestFileTransformer(t *testing.T) {
require.Len(t, fds, 1)
found, _ = ach.ReadFile(filepath.Join(recondir, fds[0].Name()))
require.Equal(t, matchEntry1.IndividualName, strings.Trim(found.Batches[0].GetEntries()[0].IndividualName, " "))

// verify the timestamp on the file is in the past
fInfo, err = fds[0].Info()
require.NoError(t, err)
require.Less(t, fInfo.ModTime(), time.Now())
})
}

Expand Down

0 comments on commit cece2cc

Please sign in to comment.