Skip to content

Commit

Permalink
Lint typescript files
Browse files Browse the repository at this point in the history
  • Loading branch information
jsonmaur committed Nov 15, 2019
1 parent eb3eb67 commit 376ffdc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -36,8 +36,8 @@
"main": "dist/index.js",
"scripts": {
"clean": "rm -rf dist coverage",
"format": "prettier --write './**/*.{js,json,yml,md}'",
"format:check": "prettier --check './**/*.{js,json,yml,md}'",
"format": "prettier --write './**/*.{ts,json,yml,md}'",
"format:check": "prettier --check './**/*.{ts,json,yml,md}'",
"test": "npm run format:check && jest --coverage",
"coveralls": "cat coverage/lcov.info | coveralls",
"prebuild": "npm run clean",
Expand Down
16 changes: 12 additions & 4 deletions src/hash.spec.ts
@@ -1,9 +1,17 @@
import * as hash from "./hash"

test("hash()", async () => {
expect(hash.hash("testing")).toBe("cf80cd8aed482d5d1527d7dc72fceff84e6326592848447d2dc0b0e87dfc9a90")
expect(hash.hash("testing")).toBe(
"cf80cd8aed482d5d1527d7dc72fceff84e6326592848447d2dc0b0e87dfc9a90",
)
expect(hash.hash("testing", { algorithm: "md5" })).toBe("ae2b1fca515949e5d54fb22b8ed95575")
expect(hash.hash("testing", { salt: "yo-this-is-a-salt" })).toBe("bd3df90288d99583d1c93f00ec00d92c97c3aff241b1beffb819dbd15f68d9f6")
expect(hash.hash({ test: "hi" })).toBe("aa6d68a0aab2f834d2bc353d734907e0e0d562e1beaf99432bd665c96f5b4d7b")
expect(hash.hash("testing", { rounds: 100 })).toBe("2c66de00e03581e03866d7b62a31a7d5776419f498f479a877270294c2600321")
expect(hash.hash("testing", { salt: "yo-this-is-a-salt" })).toBe(
"bd3df90288d99583d1c93f00ec00d92c97c3aff241b1beffb819dbd15f68d9f6",
)
expect(hash.hash({ test: "hi" })).toBe(
"aa6d68a0aab2f834d2bc353d734907e0e0d562e1beaf99432bd665c96f5b4d7b",
)
expect(hash.hash("testing", { rounds: 100 })).toBe(
"2c66de00e03581e03866d7b62a31a7d5776419f498f479a877270294c2600321",
)
})
2 changes: 1 addition & 1 deletion src/utils.spec.ts
Expand Up @@ -2,5 +2,5 @@ import * as utils from "./utils"

test("stringify()", async () => {
expect(utils.stringify(1)).toBe("1")
expect(utils.stringify({ hey: "hi" })).toBe("{\"hey\":\"hi\"}")
expect(utils.stringify({ hey: "hi" })).toBe('{"hey":"hi"}')
})
2 changes: 1 addition & 1 deletion src/utils.ts
Expand Up @@ -3,5 +3,5 @@
* if the value is an object.
*/
export function stringify(value: any): string {
return typeof value === 'object' ? JSON.stringify(value) : String(value)
return typeof value === "object" ? JSON.stringify(value) : String(value)
}

0 comments on commit 376ffdc

Please sign in to comment.