@@ -9,7 +9,7 @@ const testUser = {
99} ;
1010
1111describe ( 'Login Endpoint' , ( ) => {
12- it ( 'shold return token' , ( done ) => {
12+ it ( 'should return token' , ( done ) => {
1313 request ( app . callback ( ) )
1414 . post ( '/auth/login' )
1515 . send ( testUser )
@@ -54,15 +54,18 @@ describe('getGolland Endpoint', () => {
5454} ) ;
5555
5656describe ( 'gollandResults Endpoint' , ( ) => {
57- it ( 'should return dictionary with number for every type' , ( done ) => {
57+ it ( 'should return name, result and description in object for every type' , ( done ) => {
5858 request ( app . callback ( ) )
5959 . get ( '/api/gollandResults' )
6060 . set ( 'Authorization' , token )
6161 . expect ( 200 )
6262 . end ( ( err , res ) => {
6363 if ( err ) done ( err ) ;
6464
65- expect ( Object . values ( res . body ) . every ( val => isNumber ( val ) ) ) . toBe ( true ) ;
65+ expect ( Object . values ( res . body ) . every ( val => isObject ( val ) ) ) . toBe ( true ) ;
66+ expect ( Object . values ( res . body ) . every ( val => isString ( val . name ) ) ) . toBe ( true ) ;
67+ expect ( Object . values ( res . body ) . every ( val => isString ( val . descr ) ) ) . toBe ( true ) ;
68+ expect ( Object . values ( res . body ) . every ( val => isNumber ( val . result ) ) ) . toBe ( true ) ;
6669
6770 done ( ) ;
6871 } ) ;
@@ -83,11 +86,6 @@ describe('gollandProfile Endpoint', () => {
8386 expect ( isString ( res . body . name ) ) . toBe ( true ) ;
8487 expect ( res . body ) . toHaveProperty ( 'description' ) ;
8588 expect ( isString ( res . body . description ) ) . toBe ( true ) ;
86- expect ( res . body ) . toHaveProperty ( 'recommendations' ) ;
87- expect ( isObject ( res . body . recommendations ) ) . toBe ( true ) ;
88- expect ( res . body . recommendations . every ( cur => {
89- return Object . values ( cur ) . every ( val => ! isObject ( val ) ) ;
90- } ) ) . toBe ( true ) ;
9189
9290 done ( ) ;
9391 } ) ;
@@ -194,7 +192,7 @@ describe('belbinResults Endpoint', () => {
194192//=================DISK=============================
195193
196194describe ( 'getDisk Endpoint' , ( ) => {
197- it ( 'should return question and dictionary with variants of anwer for Belbin test' , ( done ) => {
195+ it ( 'should return question and dictionary with variants of answer for Belbin test' , ( done ) => {
198196 request ( app . callback ( ) )
199197 . get ( '/api/getDisk' )
200198 . set ( 'Authorization' , token )
@@ -245,7 +243,7 @@ describe('diskResults Endpoint', () => {
245243//=================Others=============================
246244
247245describe ( 'getProfession Endpoint' , ( ) => {
248- const id = Math . floor ( Math . random ( ) * 80 ) + 1 ; // Random [1, 80]
246+ const id = Math . floor ( Math . random ( ) * 92 ) + 1 ; // Random [1, 80]
249247
250248 it ( `should return dictionary with description of profession with id = ${ id } ` , ( done ) => {
251249 request ( app . callback ( ) )
@@ -264,6 +262,7 @@ describe('getProfession Endpoint', () => {
264262 } ) ;
265263} ) ;
266264
265+
267266describe ( 'recommendations Endpoint' , ( ) => {
268267 it ( 'should return array of dictionaries with recommended professions' , ( done ) => {
269268 request ( app . callback ( ) )
@@ -277,9 +276,6 @@ describe('recommendations Endpoint', () => {
277276 expect ( res . body . every ( cur => {
278277 return Object . values ( cur ) . every ( val => ! isObject ( val ) ) ;
279278 } ) ) . toBe ( true ) ;
280- expect ( res . body . every ( cur => {
281- return ( difference ( Object . keys ( cur ) , [ 'id' , 'name' , 'image' , 'smallDescr' ] ) . length === 0 ) ;
282- } ) ) . toBe ( true ) ;
283279
284280 done ( ) ;
285281 } ) ;
0 commit comments