@@ -31,63 +31,63 @@ const { TEST_SERVER_URL, TEST_SERVER_URL_SSL, FILENAME, DROPBOX_TOKEN, styles }
3131const dirs = RNFetchBlob . fs . dirs
3232let prefix = ( ( Platform . OS === 'android' ) ? 'file://' : '' )
3333let begin = Date . now ( )
34- //
35- // describe('#230 #249 cookies manipulation', (report, done) => {
36- //
37- // RNFetchBlob
38- // .fetch('GET', `${TEST_SERVER_URL}/cookie/249230`)
39- // .then((res) => RNFetchBlob.net.getCookies())
40- // .then((cookies) => {
41- // console.log(cookies)
42- // report(<Assert
43- // key="should set 10 cookies"
44- // expect={10}
45- // actual={cookies['localhost'].length}/>)
46- // return RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/cookie-echo`)
47- // })
48- // .then((res) => {
49- // console.log(res.data)
50- // let cookies = String(res.data).split(';')
51- // report(<Assert
52- // key="should send 10 cookies"
53- // expect={10}
54- // actual={cookies.length}/>)
55- // return RNFetchBlob.net.removeCookies()
56- // })
57- // .then(() => RNFetchBlob.net.getCookies('localhost'))
58- // .then((cookies) => {
59- // report(<Assert
60- // key="should have no cookies"
61- // expect={undefined}
62- // actual={cookies['localhost']}/>)
63- // return RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/cookie-echo`)
64- // })
65- // .then((res) => {
66- // console.log(res.data)
67- // let cookies = String(res.data).split(';')
68- // cookies = _.reject(cookies, r => r.length < 2)
69- // report(<Assert
70- // key="should send no cookies"
71- // expect={0}
72- // actual={cookies.length}/>)
73- // done()
74- // })
75- //
76- // })
77- //
78- // describe('#254 IOS fs.stat lastModified date correction', (report, done) => {
79- //
80- // let path = dirs.DocumentDir + '/temp' + Date.now()
81- // fs.createFile(path, 'hello', 'utf8' )
82- // .then(() => fs.stat(path))
83- // .then((stat) => {
84- // console.log(stat)
85- // let p = stat.lastModified / Date.now()
86- // report(<Assert key="date is correct" expect={true} actual={ p< 1.05 && p > 0.95}/>)
87- // done()
88- // })
89- //
90- // })
34+
35+ describe ( '#230 #249 cookies manipulation' , ( report , done ) => {
36+
37+ RNFetchBlob
38+ . fetch ( 'GET' , `${ TEST_SERVER_URL } /cookie/249230` )
39+ . then ( ( res ) => RNFetchBlob . net . getCookies ( ) )
40+ . then ( ( cookies ) => {
41+ console . log ( cookies )
42+ report ( < Assert
43+ key = "should set 10 cookies"
44+ expect = { 10 }
45+ actual = { cookies [ 'localhost' ] . length } /> )
46+ return RNFetchBlob . fetch ( 'GET' , `${ TEST_SERVER_URL } /cookie-echo` )
47+ } )
48+ . then ( ( res ) => {
49+ console . log ( res . data )
50+ let cookies = String ( res . data ) . split ( ';' )
51+ report ( < Assert
52+ key = "should send 10 cookies"
53+ expect = { 10 }
54+ actual = { cookies . length } /> )
55+ return RNFetchBlob . net . removeCookies ( )
56+ } )
57+ . then ( ( ) => RNFetchBlob . net . getCookies ( 'localhost' ) )
58+ . then ( ( cookies ) => {
59+ report ( < Assert
60+ key = "should have no cookies"
61+ expect = { undefined }
62+ actual = { cookies [ 'localhost' ] } /> )
63+ return RNFetchBlob . fetch ( 'GET' , `${ TEST_SERVER_URL } /cookie-echo` )
64+ } )
65+ . then ( ( res ) => {
66+ console . log ( res . data )
67+ let cookies = String ( res . data ) . split ( ';' )
68+ cookies = _ . reject ( cookies , r => r . length < 2 )
69+ report ( < Assert
70+ key = "should send no cookies"
71+ expect = { 0 }
72+ actual = { cookies . length } /> )
73+ done ( )
74+ } )
75+
76+ } )
77+
78+ describe ( '#254 IOS fs.stat lastModified date correction' , ( report , done ) => {
79+
80+ let path = dirs . DocumentDir + '/temp' + Date . now ( )
81+ fs . createFile ( path , 'hello' , 'utf8' )
82+ . then ( ( ) => fs . stat ( path ) )
83+ . then ( ( stat ) => {
84+ console . log ( stat )
85+ let p = stat . lastModified / Date . now ( )
86+ report ( < Assert key = "date is correct" expect = { true } actual = { p < 1.05 && p > 0.95 } /> )
87+ done ( )
88+ } )
89+
90+ } )
9191
9292describe ( '#263 parallel request' , ( report , done ) => {
9393 let urls = [
0 commit comments