Skip to content

Commit

Permalink
test(utils): add isBoolean utils
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxingkang committed Oct 19, 2023
1 parent 337e8bf commit 09df37c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/utils/isBoolean.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { isBoolean } from './isBoolean';

describe(isBoolean.name, () => {
test('不是 Boolean', () => {
for (const value of ['a', 1, [], undefined, null, {}]) {
expect(isBoolean(value)).toBeFalsy();
}
});

test('是 Boolean', () => {
for (const value of [true, false]) {
expect(isBoolean(value)).not.toBeFalsy();
}
});
});
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/uuid.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { uuid } from './uuid';

describe(uuid.name, () => {
test('返回值为字符串', () => {
expect(typeof uuid()).toBe('string');
expect(uuid()).toBeTypeOf('string');
});

test('多次调用返回值不同', () => {
Expand Down

0 comments on commit 09df37c

Please sign in to comment.