Skip to content

Commit 8f45524

Browse files
committed
feat: add tests using real hashes
1 parent d6cb386 commit 8f45524

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

CHANGELOG.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ VS Code v0.00.0
4848
### Documentation
4949

5050
- docs: add Pomerium #3424 @desimone
51-
- docs: fix confusing sentence in pull requests section #3460 @shiv-tyag
51+
- docs: fix confusing sentence in pull requests section #3460 @shiv-tyagi
5252
- docs: remove toc from changelog @oxy @jsjoeio
5353
- docs(MAINTAINING): add information about CHANGELOG #3467 @jsjoeio
5454
- docs: move release process to MAINTAINING.md #3441 @oxy @Prashant168
@@ -76,10 +76,6 @@ VS Code v1.56.1
7676

7777
- fix(ci): update brew-bump.sh to update remote first #3438 @jsjoeio
7878

79-
### Documentation
80-
81-
- item
82-
8379
## 3.10.1
8480

8581
VS Code v1.56.1

test/unit/node/util.test.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ describe("isHashMatch", () => {
167167
const _hash = hash(password)
168168
expect(isHashMatch("otherPassword123", _hash)).toBe(false)
169169
})
170+
it("should return true with actual hash", () => {
171+
const password = "password"
172+
const _hash = "$2b$10$GA/eZnlboeV9eW8LnntPqe1dZE7tQ/./wCdc7NgJhMRB.xhaJfmG."
173+
expect(isHashMatch(password, _hash)).toBe(true)
174+
})
170175
})
171176

172177
describe("hashLegacy", () => {
@@ -177,7 +182,7 @@ describe("hashLegacy", () => {
177182
})
178183
})
179184

180-
describe("isHashLegacyMatchh", () => {
185+
describe("isHashLegacyMatch", () => {
181186
it("should return true if is match", () => {
182187
const password = "password123"
183188
const _hash = hashLegacy(password)
@@ -188,4 +193,10 @@ describe("isHashLegacyMatchh", () => {
188193
const _hash = hashLegacy(password)
189194
expect(isHashLegacyMatch("otherPassword123", _hash)).toBe(false)
190195
})
196+
it("should return true if hashed from command line", () => {
197+
const password = "password123"
198+
// Hashed using printf "password123" | sha256sum | cut -d' ' -f1
199+
const _hash = "ef92b778bafe771e89245b89ecbc08a44a4e166c06659911881f383d4473e94f"
200+
expect(isHashLegacyMatch(password, _hash)).toBe(true)
201+
})
191202
})

0 commit comments

Comments
 (0)