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:
Aurélien Sibiril
2026-07-25 09:00:36 +02:00
parent 4cbc35e79f
commit 433aca28cb
4 changed files with 178 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ import (
"context"
"os"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -50,6 +51,10 @@ func TestDotfileDriver(t *testing.T) {
require.NotNil(t, owner.Active)
assert.True(t, *owner.Active)
assert.Equal(t, []string{"owner"}, owner.Roles)
// 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, owner.CreatedAt)
assert.Equal(t, "2023-01-31T13:30:00Z", owner.CreatedAt.UTC().Format(time.RFC3339))
// Admin: also administrative.
admin := records[1]