Skip to content

Commit

Permalink
**Not-related** Add password behavior test
Browse files Browse the repository at this point in the history
  • Loading branch information
Krisztian Gulyas committed Jan 14, 2022
1 parent cf13fb7 commit 0da9f5f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/framework/auth/hash_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,14 @@
(deftest test-assert-functionality
(let [fragment {:deps {:auth {:hash-algorithm :argon2}}}]
(is (thrown? java.lang.AssertionError (hash/make fragment password)))))

(deftest hash-behavior
(let [pwd "not_nil"
state {:deps {:auth {:hash-algorithm :bcrypt
:bcrypt-settings {:work-factor 11}}}}
hash1 (hash/make state pwd)
hash2 (hash/make state pwd)]
(is (false? (hash/check state hash1 hash2)))
(is (not= hash1 hash2))
(is (true? (and (hash/check state pwd hash1)
(hash/check state pwd hash2))))))

0 comments on commit 0da9f5f

Please sign in to comment.