Files
android_development/tools/repo_diff/service/repodiff/utils/time_test.go
Scott Lobdell 6779d3a5e7 Adding query to find the first occurrence of seeing a commit
Test: Unit tests included
Change-Id: If6e3cc70c65a8b179cb315cbfc95d300c92649d7
2018-05-02 09:03:48 -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")
}