small fixes

This commit is contained in:
Paramtamtam 2022-01-31 13:44:21 +05:00
parent cc6cbc7d47
commit 32b92611a7
No known key found for this signature in database
GPG Key ID: 366371698FAD0A2B
3 changed files with 21 additions and 3 deletions

View File

@ -4,8 +4,6 @@ import (
"strconv"
"time"
"github.com/tarampampam/error-pages/internal/tpl"
"github.com/fasthttp/router"
"github.com/tarampampam/error-pages/internal/checkers"
"github.com/tarampampam/error-pages/internal/config"
@ -17,6 +15,7 @@ import (
notfoundHandler "github.com/tarampampam/error-pages/internal/http/handlers/notfound"
versionHandler "github.com/tarampampam/error-pages/internal/http/handlers/version"
"github.com/tarampampam/error-pages/internal/metrics"
"github.com/tarampampam/error-pages/internal/tpl"
"github.com/tarampampam/error-pages/internal/version"
"github.com/valyala/fasthttp"
"go.uber.org/zap"

View File

@ -44,3 +44,23 @@ func TestProperties_Replaces(t *testing.T) {
assert.Equal(t, "", r["message"])
assert.Equal(t, "", r["description"])
}
func TestProperties_Hash(t *testing.T) {
props1 := tpl.Properties{Code: "123"}
props2 := tpl.Properties{Code: "123"}
hash1, err := props1.Hash()
assert.NoError(t, err)
hash2, err := props2.Hash()
assert.NoError(t, err)
assert.Equal(t, hash1, hash2)
props2.Code = "321"
hash2, err = props2.Hash()
assert.NoError(t, err)
assert.NotEqual(t, hash1, hash2)
}

View File

@ -10,7 +10,6 @@ import (
"time"
"github.com/pkg/errors"
"github.com/tarampampam/error-pages/internal/version"
)