mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* Move all public connectors to ce/plugins * Update tooling to account for new go modules under ce * Ensure we test all CE plugins in CI * Move Dummypay to ce/plugins for simplicity's sake in the generation scripts * Use versioned pkg/domain in plugins * Ensure that renovate updates all CE plugins in a single PR when pkg/domain tags are pushed to github * Ensure Justfile commands work over all CE plugins * Copy ce plugin go.mods in dev.Dockerfile * Only add a go.mod for new plugins if they are ce * Ensure generated generic client structs are named correctly for submodule * Add coverprofile for each ce plugin * Add set -e for Justfile for loops over plugins * Infer go version from flake.nix in connector template tool
46 lines
1.0 KiB
Go
46 lines
1.0 KiB
Go
package client
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestFormatToTransactionDate(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
utc := time.FixedZone("", 0)
|
|
|
|
// Modulr's toTransactionDate filter is whole-second and inclusive, so truncating a
|
|
// millisecond ceiling down to its second still returns the ceiling transaction.
|
|
tests := []struct {
|
|
name string
|
|
in time.Time
|
|
want string
|
|
}{
|
|
{
|
|
name: "whole second is left unchanged",
|
|
in: time.Date(2026, 6, 18, 13, 54, 29, 0, utc),
|
|
want: "2026-06-18T13:54:29+0000",
|
|
},
|
|
{
|
|
name: "milliseconds are truncated down to the second",
|
|
in: time.Date(2026, 6, 18, 13, 54, 29, 18_000_000, utc),
|
|
want: "2026-06-18T13:54:29+0000",
|
|
},
|
|
{
|
|
name: "sub-millisecond is also truncated down",
|
|
in: time.Date(2026, 6, 18, 13, 54, 29, 1, utc),
|
|
want: "2026-06-18T13:54:29+0000",
|
|
},
|
|
}
|
|
|
|
for _, tc := range tests {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
t.Parallel()
|
|
require.Equal(t, tc.want, formatToTransactionDate(tc.in))
|
|
})
|
|
}
|
|
}
|