aboutsummaryrefslogtreecommitdiff
path: root/cmd/site/internal/date_test.go
blob: 87065482a3cd6745d52f02dcaeb634a64b06e469 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package internal

import (
	"fmt"
	"testing"
	"time"
)

func TestIOS13Detri(t *testing.T) {
	cases := []struct {
		in  time.Time
		out string
	}{
		{
			in:  time.Date(2019, time.March, 30, 0, 0, 0, 0, time.FixedZone("UTC", 0)),
			out: "2019 M03 30",
		},
	}

	for _, cs := range cases {
		t.Run(fmt.Sprintf("%s -> %s", cs.in.Format(time.RFC3339), cs.out), func(t *testing.T) {
			result := IOS13Detri(cs.in)
			if result != cs.out {
				t.Fatalf("wanted: %s, got: %s", cs.out, result)
			}
		})
	}
}