@@ -13,6 +13,7 @@ import {
1313 hasDefinedType ,
1414} from './assembly-line' ;
1515import { ElectronicDevice } from './lib.js' ;
16+
1617describe ( 'isBoolean' , ( ) => {
1718 test ( 'isBoolean works on booleans' , ( ) => {
1819 expect ( isBoolean ( true ) ) . toBe ( true ) ;
@@ -26,6 +27,7 @@ describe('isBoolean', () => {
2627 expect ( isBoolean ( Symbol ( '1' ) ) ) . toBe ( false ) ;
2728 } ) ;
2829} ) ;
30+
2931describe ( 'isNumber' , ( ) => {
3032 test ( 'isNumber works on numbers' , ( ) => {
3133 expect ( isNumber ( 42 ) ) . toBe ( true ) ;
@@ -49,13 +51,15 @@ describe('isNumber', () => {
4951 expect ( isNumber ( Infinity ) ) . toBe ( false ) ;
5052 } ) ;
5153} ) ;
54+
5255class ClassForTesting {
5356 constructor ( number , word ) {
5457 this . number = number ;
5558 this . word = word ;
5659 }
5760 id ( ) { }
5861}
62+
5963describe ( 'isObject' , ( ) => {
6064 test ( 'isObject works on objects' , ( ) => {
6165 expect ( isObject ( { } ) ) . toBe ( true ) ;
@@ -77,6 +81,7 @@ describe('isObject', () => {
7781 expect ( isObject ( null ) ) . toBe ( false ) ;
7882 } ) ;
7983} ) ;
84+
8085describe ( 'isNumericString' , ( ) => {
8186 test ( 'isNumericString works on numeric strings' , ( ) => {
8287 expect ( isNumericString ( '42' ) ) . toBe ( true ) ;
@@ -95,10 +100,12 @@ describe('isNumericString', () => {
95100 expect ( isNumericString ( Symbol ( '\u0070' ) ) ) . toBe ( false ) ;
96101 } ) ;
97102} ) ;
103+
98104class Oven extends ElectronicDevice { }
99105class Computer extends ElectronicDevice { }
100106class PersonalComputer extends Computer { }
101107class HomeMadePersonalComputer extends PersonalComputer { }
108+
102109describe ( 'isElectronic' , ( ) => {
103110 test ( 'isElectronic works on instances of ElectronicDevice or its child classes' , ( ) => {
104111 expect ( isElectronic ( new ElectronicDevice ( ) ) ) . toBe ( true ) ;
@@ -124,6 +131,7 @@ describe('isElectronic', () => {
124131 expect ( isElectronic ( new HomeMadePersonalComputer ( ) ) ) . toBe ( true ) ;
125132 } ) ;
126133} ) ;
134+
127135describe ( 'isNonEmptyArray' , ( ) => {
128136 test ( 'isNonEmptyArray works on non-empty arrays' , ( ) => {
129137 expect ( isNonEmptyArray ( [ 1 , 2 , 3 ] ) ) . toBe ( true ) ;
@@ -152,9 +160,11 @@ describe('isEmptyArray', () => {
152160 expect ( isEmptyArray ( 123 ) ) . toBe ( false ) ;
153161 } ) ;
154162} ) ;
163+
155164class TestAssertHasId {
156165 id ( ) { }
157166}
167+
158168describe ( 'assertHasId' , ( ) => {
159169 test ( "assertHasId throws error if object has no 'id' property or method" , ( ) => {
160170 expect ( ( ) => assertHasId ( { } ) ) . toThrow ( ) ;
@@ -164,9 +174,11 @@ describe('assertHasId', () => {
164174 expect ( ( ) => assertHasId ( new TestAssertHasId ( ) ) ) . not . toThrow ( ) ;
165175 } ) ;
166176} ) ;
177+
167178class TestHasType {
168179 type ( ) { }
169180}
181+
170182describe ( 'hasType' , ( ) => {
171183 test ( 'hasType works correctly' , ( ) => {
172184 expect ( hasType ( { type : 'example' } ) ) . toBe ( true ) ;
0 commit comments