未验证 提交 fc3326f1 编写于 作者: J Joe Previte

feat: add tests using real hashes

上级 aaf04472
...@@ -48,7 +48,7 @@ VS Code v0.00.0 ...@@ -48,7 +48,7 @@ VS Code v0.00.0
### Documentation ### Documentation
- docs: add Pomerium #3424 @desimone - docs: add Pomerium #3424 @desimone
- docs: fix confusing sentence in pull requests section #3460 @shiv-tyag - docs: fix confusing sentence in pull requests section #3460 @shiv-tyagi
- docs: remove toc from changelog @oxy @jsjoeio - docs: remove toc from changelog @oxy @jsjoeio
- docs(MAINTAINING): add information about CHANGELOG #3467 @jsjoeio - docs(MAINTAINING): add information about CHANGELOG #3467 @jsjoeio
- docs: move release process to MAINTAINING.md #3441 @oxy @Prashant168 - docs: move release process to MAINTAINING.md #3441 @oxy @Prashant168
...@@ -82,10 +82,6 @@ VS Code v1.56.1 ...@@ -82,10 +82,6 @@ VS Code v1.56.1
- fix(ci): update brew-bump.sh to update remote first #3438 @jsjoeio - fix(ci): update brew-bump.sh to update remote first #3438 @jsjoeio
### Documentation
- item
## 3.10.1 ## 3.10.1
VS Code v1.56.1 VS Code v1.56.1
......
...@@ -167,6 +167,11 @@ describe("isHashMatch", () => { ...@@ -167,6 +167,11 @@ describe("isHashMatch", () => {
const _hash = hash(password) const _hash = hash(password)
expect(isHashMatch("otherPassword123", _hash)).toBe(false) expect(isHashMatch("otherPassword123", _hash)).toBe(false)
}) })
it("should return true with actual hash", () => {
const password = "password"
const _hash = "$2b$10$GA/eZnlboeV9eW8LnntPqe1dZE7tQ/./wCdc7NgJhMRB.xhaJfmG."
expect(isHashMatch(password, _hash)).toBe(true)
})
}) })
describe("hashLegacy", () => { describe("hashLegacy", () => {
...@@ -177,7 +182,7 @@ describe("hashLegacy", () => { ...@@ -177,7 +182,7 @@ describe("hashLegacy", () => {
}) })
}) })
describe("isHashLegacyMatchh", () => { describe("isHashLegacyMatch", () => {
it("should return true if is match", () => { it("should return true if is match", () => {
const password = "password123" const password = "password123"
const _hash = hashLegacy(password) const _hash = hashLegacy(password)
...@@ -188,4 +193,10 @@ describe("isHashLegacyMatchh", () => { ...@@ -188,4 +193,10 @@ describe("isHashLegacyMatchh", () => {
const _hash = hashLegacy(password) const _hash = hashLegacy(password)
expect(isHashLegacyMatch("otherPassword123", _hash)).toBe(false) expect(isHashLegacyMatch("otherPassword123", _hash)).toBe(false)
}) })
it("should return true if hashed from command line", () => {
const password = "password123"
// Hashed using printf "password123" | sha256sum | cut -d' ' -f1
const _hash = "ef92b778bafe771e89245b89ecbc08a44a4e166c06659911881f383d4473e94f"
expect(isHashLegacyMatch(password, _hash)).toBe(true)
})
}) })
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册