MCPcopy Index your code
hub / github.com/apache/devlake / TestCSTTime

Function TestCSTTime

backend/core/models/common/cst_time_test.go:38–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

36}
37
38func TestCSTTime(t *testing.T) {
39 pairs := map[string]time.Time{
40 `{ "Created": "2021-07-30 19:14:33" }`: TimeMustParse("2021-07-30T11:14:33Z"),
41 `{ "Created": "2021-07-30" }`: TimeMustParse("2021-07-29T16:00:00Z"),
42 }
43
44 for input, expected := range pairs {
45 var record CSTTimeRecord
46 err := errors.Convert(json.Unmarshal([]byte(input), &record))
47 assert.Nil(t, err)
48 assert.Equal(t, expected, time.Time(record.Created).UTC())
49 }
50}

Callers

nothing calls this directly

Calls 2

TimeMustParseFunction · 0.70
ConvertMethod · 0.45

Tested by

no test coverage detected