Files
sdk/ux/duration_test.go
zeekayandHanzo Dev da299df77d the corporate name is Lux Industries Inc
Lux Partners Limited is not the entity behind this work. Every place the
old name stood — copyright lines, site footers, brand config, legal and
compliance text — now names the company that actually holds it.

lux.fund is the exception and is not renamed to match: that site belongs
to Lux Assets Management LLC, a different company, and it says so.

Two kinds of line were left for a person rather than rewritten. A dated
news item recording that Lux Partners Limited was established in the Isle
of Man is a historical fact, and renaming it would falsify the record. And
a sentence asserting that the company is domiciled in the Isle of Man is a
claim about a jurisdiction, not a name — an Inc or an LLC is not an Isle
of Man company, so swapping the name there would assert something untrue.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-28 13:05:15 -07:00

80 lines
1.5 KiB
Go

// Copyright (C) 2022, Lux Industries Inc All rights reserved.
// See the file LICENSE for licensing terms.
package ux
import (
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestDurationFormat(t *testing.T) {
require := require.New(t)
type test struct {
d time.Duration
expected string
}
tests := []test{
{
d: 972 * 24 * time.Hour,
expected: "2 years 242 days ",
},
{
d: 364 * 24 * time.Hour,
expected: "364 days ",
},
{
d: 42 * 24 * time.Hour,
expected: "42 days ",
},
{
d: 1 * 24 * time.Hour,
expected: "1 days ",
},
{
d: 23 * time.Hour,
expected: "23 hours ",
},
{
d: 42*time.Hour + 42*time.Minute,
expected: "1 days 18 hours 42 minutes ",
},
{
d: 42 * time.Minute,
expected: "42 minutes ",
},
{
d: 42*time.Minute + 42*time.Second,
expected: "42 minutes 42 seconds ",
},
{
d: 42 * time.Second,
expected: "42 seconds ",
},
{
d: 342*24*time.Hour + 42*time.Second,
expected: "342 days 42 seconds ",
},
{
d: 342*24*time.Hour + 1*time.Hour + 42*time.Second,
expected: "342 days 1 hours 42 seconds ",
},
{
d: 342*24*time.Hour + 42*time.Minute + 42*time.Second,
expected: "342 days 42 minutes 42 seconds ",
},
{
d: 342*24*time.Hour + 42*time.Minute,
expected: "342 days 42 minutes ",
},
}
for _, t := range tests {
s := FormatDuration(t.d)
require.Equal(t.expected, s)
}
}