Skip to content

Commit

Permalink
Merge pull request #77 from suyuan32/dev
Browse files Browse the repository at this point in the history
fix: add test for BcryptCheck
  • Loading branch information
suyuan32 authored Aug 4, 2023
2 parents 6aa2ba9 + 94ca8e7 commit b9ce7eb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions utils/encrypt/encrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,29 @@ func TestEncrypt(t *testing.T) {
assert.Equal(t, result, true)
}
}

func TestBcryptCheck(t *testing.T) {
type args struct {
password string
hash string
}
tests := []struct {
name string
args args
want bool
}{
{
name: "test1",
args: args{
password: "simple-admin",
hash: "$2a$10$RGY8FVLUSKNMdKQr/y2oi.kh4r/ns6hbpJc.0RP56jd3gazeOJa42",
},
want: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert.Equalf(t, tt.want, BcryptCheck(tt.args.password, tt.args.hash), "BcryptCheck(%v, %v)", tt.args.password, tt.args.hash)
})
}
}

0 comments on commit b9ce7eb

Please sign in to comment.