File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
packages/core/tests/utils Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments