mirror of
https://github.com/edgebox-iot/edgeboxctl.git
synced 2026-09-24 05:41:43 +02:00
Add test foundations (#14)
This commit is contained in:
@@ -25,4 +25,4 @@ jobs:
|
|||||||
run: make build
|
run: make build
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: go test -v ./...
|
run: make test
|
||||||
|
|||||||
@@ -24,3 +24,6 @@ build:
|
|||||||
clean:
|
clean:
|
||||||
rm -rf ${BUILD_DIR}
|
rm -rf ${BUILD_DIR}
|
||||||
go clean
|
go clean
|
||||||
|
|
||||||
|
test:
|
||||||
|
go test -tags=unit -timeout=600s -v ./...
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// +build unit
|
||||||
|
|
||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGetSQLiteFormattedDateTime(t *testing.T) {
|
||||||
|
datetime := time.Date(2021, time.Month(1), 01, 1, 30, 15, 0, time.UTC)
|
||||||
|
result := GetSQLiteFormattedDateTime(datetime)
|
||||||
|
|
||||||
|
if result != "2021-01-01 01:30:15" {
|
||||||
|
t.Log("Expected 2021-01-01 01:30:15 but got ", result)
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user