Unit-test the connector helper functions
The cassettes cannot reach these branches. Every fixture email is already lowercase, so nothing exercised the trim-and-lowercase that is the Google Analytics driver's whole merge key; likewise the Dotfile role casing and the Segment role dedup and case-insensitive owner match. The Dotfile and Square tests never asserted CreatedAt, which parseRFC3339Ptr silently nils on any format mismatch — both cassettes carry usable timestamps, so a dropped field looked like a clean pass. Also gives the Square OAuth variables their own comment in the example env file; they sat under the Google Analytics one. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -49,6 +50,10 @@ func TestSquareDriver(t *testing.T) {
|
||||
assert.Equal(t, []string{"Member"}, member.Roles)
|
||||
require.NotNil(t, member.Active)
|
||||
assert.True(t, *member.Active)
|
||||
// parseRFC3339Ptr nils on any format mismatch, so pin the parsed instant:
|
||||
// a silently dropped created_at would otherwise look like a clean pass.
|
||||
require.NotNil(t, member.CreatedAt)
|
||||
assert.Equal(t, "2020-03-24T18:14:26Z", member.CreatedAt.UTC().Format(time.RFC3339))
|
||||
|
||||
// Owner → is_owner drives IsAdmin directly.
|
||||
owner := records[1]
|
||||
|
||||
Reference in New Issue
Block a user