From ec16f91f7b43ad21a8fe0e88b5c147187603d739 Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Thu, 15 Jul 2021 01:24:47 +0700 Subject: [PATCH] test: added one more test --- .github/workflows/api.yml | 4 ++-- api/app/v1/utils/date_test.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index 5875dc7..964360e 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -38,10 +38,10 @@ jobs: run: go mod vendor - name: Build - run: go build ./ + run: go build main.go - name: Run test & coverage - run: go test -v -race -coverprofile=coverage.out -covermode=atomic -failfast ./... + run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./... - name: Initialize CodeQL uses: github/codeql-action/init@v1 diff --git a/api/app/v1/utils/date_test.go b/api/app/v1/utils/date_test.go index 02591a7..b96c3a1 100644 --- a/api/app/v1/utils/date_test.go +++ b/api/app/v1/utils/date_test.go @@ -27,4 +27,14 @@ func TestIsToday(t *testing.T) { t.Error("today should be false:", today) } }) + + t.Run("should return false with no error if no date is supplied", func(t *testing.T) { + today, err := utils.IsToday("") + if err != nil { + t.Error(err.Error()) + } + if today != false { + t.Error("it should be false:", today) + } + }) }