From 9da6db076b1605c63b884b5cd35d9a5726b9b6f5 Mon Sep 17 00:00:00 2001 From: valitovgaziz Date: Thu, 15 Aug 2024 08:25:49 +0500 Subject: [PATCH] hash test --- Makefile | 6 ++++++ api/Makefile | 7 +++++++ api/src/auth/auth_test.go | 16 ++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 api/Makefile create mode 100644 api/src/auth/auth_test.go diff --git a/Makefile b/Makefile index c5992eb..1d0043e 100644 --- a/Makefile +++ b/Makefile @@ -7,4 +7,10 @@ run: build clean: @docker builder prune +test: + @go test ./api/src/auth/... -v + +tc: + @go test -cover + .DEFAULT_GOAL=run \ No newline at end of file diff --git a/api/Makefile b/api/Makefile new file mode 100644 index 0000000..142f73f --- /dev/null +++ b/api/Makefile @@ -0,0 +1,7 @@ +t: + @go test ./... -v + +tc: + go + +@DEFAULT_GOAL=t \ No newline at end of file diff --git a/api/src/auth/auth_test.go b/api/src/auth/auth_test.go new file mode 100644 index 0000000..6232c1d --- /dev/null +++ b/api/src/auth/auth_test.go @@ -0,0 +1,16 @@ +package auth + +import ( + "testing" + + "golang.org/x/crypto/bcrypt" +) + +func Test_hashPass(t *testing.T) { + password := "some hard password" + hash, _ := hashPassword(password) + err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) + if err != nil { + t.Errorf("Falis by: %s", err) + } +}