a l c u l a t o r ' , f u n c t i o n ( ) { s u i t e ( ' A d d ' , f u n c t i o n ( ) { t e s t ( " u s i n g b o t h p o s i t i v e n u m b e r s " , f u n c t i o n ( ) { / / t e s t a s s e r t i o n } ) ; t e s t ( " u s i n g b o t h n e g a t i v e n u m b e r s " , f u n c t i o n ( ) { / / t e s t a s s e r t i o n } ) ; } ) ; } ) ;
' C a l c u l a t o r ' , f u n c t i o n ( ) { s e t u p ( f u n c t i o n ( ) { / / r u n s b e f o r e t e s t } ) ; / / t e s t ( " a d d u s i n g b o t h p o s i t i v e n u m b e r s " , f u n c t i o n ( ) { / / t e s t a s s e r t i o n / / } ) ; t e a r d o w n ( f u n c t i o n ( ) { / / r u n s a f t e r t e s t s } ) ; } ) ;
( ' C a l c u l a t o r ' , f u n c t i o n ( ) { d e s c r i b e ( ' a d d ' , f u n c t i o n ( ) { i t ( ' u s i n g b o t h p o s i t i v e n u m b e r s ' , f u n c t i o n ( ) { / / t e s t a s s e r t i o n } ) ; i t ( ' u s i n g b o t h n e g a t i v e n u m b e r s ' , f u n c t i o n ( ) { / / t e s t a s s e r t i o n } ) ; } ) ; } ) ;
b e ( ' C a l c u l a t o r ' , f u n c t i o n ( ) { b e f o r e ( f u n c t i o n ( ) { } ) a f t e r ( f u n c t i o n ( ) { } ) } ) ; beforeEach afterEach
t o r . j s C a l c u l a t o r = { a d d : f u n c t i o n ( a , b ) { r e t u r n a + b ; } } m o d u l e . e x p o r t s = C a l c u l a t o r / / t e s t . j s v a r C a l c = r e q u i r e ( " . / c a l c u l a t o r " ) ; v a r a s s e r t = r e q u i r e ( " c h a i " ) . a s s e r t s u i t e ( " a d d " , f u n c t i o n ( ) { t e s t ( " t w o p o s i t i v e " , f u n c t i o n ( ) { a s s e r t ( C a l c . a d d ( 1 , 3 ) , 4 ) ; } ) ; t e s t ( " p o s i t i v e a n d n e g a i v e " , f u n c t i o n ( ) { a s s e r t ( C a l c . a d d ( - 5 , 4 ) , 1 ) ; } ) } ) ;
: f u n c t i o n ( a , b ) { r e t u r n a + b ; } } m o c h a . s e t u p ( ' t d d ' ) ; v a r a s s e r t = c h a i . a s s e r t ; s u i t e ( " a d d " , f u n c t i o n ( ) { t e s t ( " t w o p o s i t i v e " , f u n c t i o n ( ) { a s s e r t ( C a l c . a d d ( 1 , 3 ) , 4 ) ; } ) ; t e s t ( " p o s i t i v e a n d n e g a i v e " , f u n c t i o n ( ) { a s s e r t ( C a l c . a d d ( - 5 , 4 ) , 1 ) ; } ) } ) ; m o c h a . r u n ( ) ;
: f u n c t i o n ( a , b , f n ) { f n ( a + b ) ; } } s u i t e ( " a d d " , f u n c t i o n ( ) { t e s t ( " t w o p o s i t i v e " , f u n c t i o n ( d o n e ) { C a l c . a d d ( 1 , 3 , f u n c t i o n ( r e s u l t ) { a s s e r t ( r e s u l t , 4 ) ; d o n e ( ) ; } ) } ) ; } ) ;
u i t e ( " a d d " , f u n c t i o n ( ) { t e s t . o n l y ( " t w o p o s i t i v e " , f u n c t i o n ( ) { a s s e r t ( C a l c . a d d ( 1 , 3 ) , 4 ) ; } ) ; t e s t ( " p o s i t i v e a n d n e g a i v e " , f u n c t i o n ( d o n e ) { a s s e r t ( C a l c . a d d ( - 5 , 4 ) , - 1 ) ; } ) } ) ;
d d " , f u n c t i o n ( ) { t e s t . s k i p ( " t w o p o s i t i v e " , f u n c t i o n ( ) { a s s e r t ( C a l c . a d d ( 1 , 3 ) , 4 ) ; } ) ; t e s t ( " p o s i t i v e a n d n e g a i v e " , f u n c t i o n ( d o n e ) { a s s e r t ( C a l c . a d d ( - 5 , 4 ) , - 1 ) ; } ) } ) ;
x p o r t s = f u n c t i o n ( g r u n t ) { g r u n t . l o a d N p m T a s k s ( ' g r u n t - m o c h a ' ) ; g r u n t . i n i t C o n f i g ( { m o c h a : { t e s t : { s r c : [ ' t e s t s / * * / * . h t m l ' ] , } , } } ) ; }
r e q u i r e ( ' g u l p ' ) ; v a r m o c h a = r e q u i r e ( ' g u l p - m o c h a ' ) ; g u l p . t a s k ( ' d e f a u l t ' , f u n c t i o n ( ) { r e t u r n g u l p . s r c ( ' t e s t . j s ' , { u i : t d d } ) . p i p e ( m o c h a ( ) ) ; } ) ;