11describe ( 'Content API' , function ( ) {
2+ 'use strict' ;
3+
24 var REST_REQUESTS_TIMEOUT = 3000 ;
35
46 var token ,
5- data = { } ;
7+ data = { } ,
8+ fileUID = '97f5802dcbd34a59a4921d73f6baedd000' ,
9+ urlToBlobs = 'https://api.quickblox.com/blobs/' ;
610
711 beforeAll ( function ( done ) {
812 QB . init ( CREDENTIALS . appId , CREDENTIALS . authKey , CREDENTIALS . authSecret ) ;
@@ -31,7 +35,7 @@ describe('Content API', function() {
3135 } else {
3236 expect ( res ) . not . toBeNull ( ) ;
3337 expect ( res . name ) . toBe ( 'QB.txt' ) ;
34- console . info ( 'can create and upload files' ) ;
38+
3539 done ( ) ;
3640 }
3741 } ) ;
@@ -44,7 +48,7 @@ describe('Content API', function() {
4448 } else {
4549 expect ( res ) . not . toBeNull ( ) ;
4650 expect ( res . items . length ) . toBeGreaterThan ( 0 ) ;
47- console . info ( 'can list content objects' ) ;
51+
4852 done ( ) ;
4953 }
5054 } ) ;
@@ -62,7 +66,6 @@ describe('Content API', function() {
6266 done . fail ( "Delete content objects error: " + JSON . stringify ( err ) ) ;
6367 } else {
6468 expect ( result ) . toEqual ( true ) ;
65- console . info ( 'can delete content objects' ) ;
6669
6770 done ( ) ;
6871 }
@@ -79,30 +82,22 @@ describe('Content API', function() {
7982 expect ( res ) . not . toBeNull ( ) ;
8083 expect ( res . blob . id ) . toEqual ( 2917985 ) ;
8184 expect ( res . blob . size ) . toBe ( 15 ) ;
82- console . info ( 'can get file information by ID' ) ;
8385
8486 done ( ) ;
8587 }
8688 } ) ;
8789 } , REST_REQUESTS_TIMEOUT ) ;
8890
89- // Private Url
90- //
91- it ( 'can access private URL' , function ( ) {
92- var fileUID = "97f5802dcbd34a59a4921d73f6baedd000" ,
93- privateURL = QB . content . privateUrl ( fileUID ) ;
94-
95- expect ( privateURL ) . toBe ( "https://api.quickblox.com/blobs/97f5802dcbd34a59a4921d73f6baedd000?token=" + token ) ;
91+ it ( 'can access public URL' , function ( ) {
92+ var publicUrl = QB . content . publicUrl ( fileUID ) ;
9693
97- console . info ( 'can access private URL' ) ;
94+ expect ( publicUrl ) . toEqual ( urlToBlobs + fileUID ) ;
9895 } ) ;
9996
100- // Public Url
101- //
102- it ( 'can access public URL' , function ( ) {
103- var fileUID = "97f5802dcbd34a59a4921d73f6baedd000" ,
104- publicUrl = QB . content . publicUrl ( fileUID ) ;
97+ it ( 'can access private URL' , function ( ) {
98+ var privateURL = QB . content . privateUrl ( fileUID ) ;
99+ var url = urlToBlobs + fileUID + '?token=' ;
105100
106- expect ( publicUrl ) . toEqual ( "https://api.quickblox.com/blobs/97f5802dcbd34a59a4921d73f6baedd000" ) ;
101+ expect ( privateURL ) . toBe ( url + token ) ;
107102 } ) ;
108103} ) ;
0 commit comments