Archived
1
0

fix: sanitize password and cookie key

This commit is contained in:
Joe Previte
2021-06-07 14:46:59 -07:00
parent deaa2242ca
commit 3b50bfc17d
6 changed files with 30 additions and 6 deletions

View File

@ -7,6 +7,7 @@ import {
hashLegacy,
isHashLegacyMatch,
isCookieValid,
sanitizeString,
} from "../../../src/node/util"
describe("getEnvPaths", () => {
@ -382,3 +383,15 @@ describe.only("isCookieValid", () => {
expect(isValid).toBe(false)
})
})
describe.only("sanitizeString", () => {
it("should return an empty string if passed a type other than a string", () => {
expect(sanitizeString({} as string)).toBe("")
})
it("should trim whitespace", () => {
expect(sanitizeString(" hello ")).toBe("hello")
})
it("should always return an empty string", () => {
expect(sanitizeString(" ")).toBe("")
})
})