Files
android_development/tools/repo_diff/service/repodiff/utils/time_test.go
Scott Lobdell ceb0b6a273 Complete functionality to add the first seen timestamp to non-upstreamed
commits

Test: Unit tests included, running locally
Change-Id: I0b2fd022a37c2d35ee46127ae17a06bf66580500
2018-05-14 14:26:32 -07:00

27 lines
694 B
Go

package utils
import (
"testing"
"github.com/stretchr/testify/assert"
ent "repodiff/entities"
)
func TestTimestampSeconds(t *testing.T) {
var oldTimestamp ent.RepoTimestamp = 1519322647
newTimestamp := TimestampSeconds()
assert.True(t, newTimestamp > oldTimestamp, "New timestamp should be greater than fixture")
}
func TestTimestampToDate(t *testing.T) {
var timestamp ent.RepoTimestamp = 1519322647
assert.Equal(t, "2018-02-22", TimestampToDate(timestamp), "Date conversion")
}
func TestTimestampToDataStudioDatetime(t *testing.T) {
var timestamp ent.RepoTimestamp = 1519322647
assert.Equal(t, "2018022210", TimestampToDataStudioDatetime(timestamp), "Datetime conversion")
}