Adding initial code for the main.go as well as initial code for uploading members

This commit is contained in:
2026-01-19 20:03:40 -05:00
parent 6b17c6fddc
commit 0359efe197
9 changed files with 572 additions and 2 deletions

View File

@@ -0,0 +1,45 @@
package services
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParseMembersFromBytes(t *testing.T) {
testCases := []struct {
name string
input string
expected []Member
}{
{
name: "Valid CSV with multiple members",
input: `date,First,Last,Email
2023-01-01,John,Doe,john.doe@example.com
2023-01-02,Jane,Smith,jane.smith@example.com`,
expected: []Member{
{Name: "John Doe", Email: "john.doe@example.com"},
{Name: "Jane Smith", Email: "jane.smith@example.com"},
},
},
{
name: "CSV with missing fields",
input: `date,First,Last
2023-01-01,John,Doe`,
expected: []Member{},
},
{
name: "Empty CSV",
input: ``,
expected: []Member{},
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
members, err := ParseMembersFromBytes(2023, []byte(tc.input))
assert.NoError(t, err)
assert.Equal(t, tc.expected, members)
})
}
}