Skip to content

Commit 2c57a08

Browse files
committed
test(core): isPlainObject covered with tests
1 parent db839db commit 2c57a08

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { describe, expect, it } from 'vitest';
2+
import { isPlainObject } from '../../src';
3+
4+
class Foo {}
5+
const fooInstance = new Foo();
6+
7+
describe('isPlainObject', () => {
8+
it('should return true for plain object', () => expect(isPlainObject({})).toBe(true));
9+
it('should return true for plain object with properties', () => expect(isPlainObject({ a: 1 })).toBe(true));
10+
it('should return false for array', () => expect(isPlainObject([])).toBe(false));
11+
it('should return false for string', () => expect(isPlainObject('x')).toBe(false));
12+
it('should return false for number', () => expect(isPlainObject(42)).toBe(false));
13+
it('should return false for boolean', () => expect(isPlainObject(true)).toBe(false));
14+
it('should return false for null', () => expect(isPlainObject(null)).toBe(false));
15+
it('should return false for undefined', () => expect(isPlainObject(undefined)).toBe(false));
16+
it('should return false for class prototype', () => expect(isPlainObject(Foo)).toBe(false));
17+
it('should return false for class instance', () => expect(isPlainObject(fooInstance)).toBe(false));
18+
});

0 commit comments

Comments
 (0)