Skip to content

Commit 8a974e1

Browse files
committed
test: update tests
1 parent 8f08f63 commit 8a974e1

9 files changed

Lines changed: 19 additions & 19 deletions

File tree

.oxlintrc.base.jsonc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@
197197
// loops
198198
"i",
199199
"j",
200-
// type generics
201-
"T",
200+
"k",
202201
// parameter name for unused variables
203202
"_",
204203
],
@@ -257,11 +256,12 @@
257256
"typescript/no-non-null-assertion": "off",
258257
"typescript/prefer-ts-expect-error": "off",
259258
"typescript/require-array-sort-compare": "off",
260-
"vitest/prefer-called-once": "off",
261259
"vitest/consistent-test-filename": [
262260
"warn",
263-
{ "allTestPattern": "__tests__", "pattern": ".*\\.spec\\.ts$" },
261+
{ "allTestPattern": "__tests__", "pattern": ".*\\.spec\\.{js,ts}$" },
264262
],
263+
"vitest/prefer-called-once": "off",
264+
"vitest/prefer-to-be-truthy": "off",
265265
"unicorn/consistent-function-scoping": "off",
266266
},
267267
},
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ describe(compare, () => {
1010
const $2ySalt = salt2.replace(/\$2b\$/, "$2y$");
1111
const hash2 = await hash("world", $2ySalt);
1212

13-
expect(await compare("hello", hash1)).toBeTruthy();
14-
expect(await compare("hello", hash2)).toBeFalsy();
15-
expect(await compare("world", hash1)).toBeFalsy();
16-
expect(await compare("world", hash2)).toBeTruthy();
13+
expect(await compare("hello", hash1)).toBe(true);
14+
expect(await compare("hello", hash2)).toBe(false);
15+
expect(await compare("world", hash1)).toBe(false);
16+
expect(await compare("world", hash2)).toBe(true);
1717
});
1818

1919
it("should reject with error for invalid argument types", async () => {
@@ -26,7 +26,7 @@ describe(compare, () => {
2626
});
2727

2828
it("should resolve false for invalid hash", async () => {
29-
await expect(compare("hello", "invalid")).resolves.toBeFalsy();
29+
await expect(compare("hello", "invalid")).resolves.toBe(false);
3030
});
3131

3232
it("should throw error with invalid salt", async () => {
@@ -46,12 +46,12 @@ describe(compareSync, () => {
4646
const hash2 = hashSync("world", salt2);
4747

4848
expect(hash1.slice(0, 4)).toBe("$2b$");
49-
expect(compareSync("hello", hash1)).toBeTruthy();
50-
expect(compareSync("hello", hash2)).toBeFalsy();
49+
expect(compareSync("hello", hash1)).toBe(true);
50+
expect(compareSync("hello", hash2)).toBe(false);
5151

5252
expect(hash2.slice(0, 4)).toBe("$2y$");
53-
expect(compareSync("world", hash1)).toBeFalsy();
54-
expect(compareSync("world", hash2)).toBeTruthy();
53+
expect(compareSync("world", hash1)).toBe(false);
54+
expect(compareSync("world", hash2)).toBe(true);
5555
});
5656

5757
it("should throw error for invalid argument types", () => {
@@ -64,7 +64,7 @@ describe(compareSync, () => {
6464
});
6565

6666
it("should resolve false for invalid hash", () => {
67-
expect(compareSync("hello", "invalid")).toBeFalsy();
67+
expect(compareSync("hello", "invalid")).toBe(false);
6868
});
6969

7070
it("should throw error with invalid salt", () => {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ describe(getRounds, () => {
4141

4242
describe(truncates, () => {
4343
it("should work", () => {
44-
expect(truncates("hello")).toBeFalsy();
45-
expect(truncates("a".repeat(72))).toBeFalsy();
46-
expect(truncates("a".repeat(73))).toBeTruthy();
44+
expect(truncates("hello")).toBe(false);
45+
expect(truncates("a".repeat(72))).toBe(false);
46+
expect(truncates("a".repeat(73))).toBe(true);
4747
});
4848

4949
it("should throw error for invalid argument types", () => {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ describe(nextTick, () => {
99

1010
nextTick(() => {
1111
executed = true;
12-
expect(executed).toBeTruthy();
12+
expect(executed).toBe(true);
1313
resolve();
1414
});
1515

16-
expect(executed).toBeFalsy();
16+
expect(executed).toBe(false);
1717
}));
1818

1919
it("should use setImmediate in Node.js", () => {

0 commit comments

Comments
 (0)