@@ -68,7 +68,9 @@ describe('test form io', function() {
6868 //console.log(respBody);
6969 should . not . exist ( respErr ) ;
7070 respBody . should . have . keys ( 'key' , 'hash' ) ;
71- keysToDelete . push ( respBody . key ) ;
71+ if ( ! keysToDelete . includes ( respBody . key ) ) {
72+ keysToDelete . push ( respBody . key ) ;
73+ }
7274 done ( ) ;
7375 } ) ;
7476 } ) ;
@@ -84,7 +86,9 @@ describe('test form io', function() {
8486 //console.log(respBody);
8587 should . not . exist ( respErr ) ;
8688 respBody . should . have . keys ( 'key' , 'hash' ) ;
87- keysToDelete . push ( respBody . key ) ;
89+ if ( ! keysToDelete . includes ( respBody . key ) ) {
90+ keysToDelete . push ( respBody . key ) ;
91+ }
8892 done ( ) ;
8993 } ) ;
9094 } ) ;
@@ -99,22 +103,26 @@ describe('test form io', function() {
99103 //console.log(respBody);
100104 should . not . exist ( respErr ) ;
101105 respBody . should . have . keys ( 'key' , 'hash' ) ;
102- keysToDelete . push ( respBody . key ) ;
106+ if ( ! keysToDelete . includes ( respBody . key ) ) {
107+ keysToDelete . push ( respBody . key ) ;
108+ }
103109 done ( ) ;
104110 } ) ;
105111 } ) ;
106112 } ) ;
107113
108114 describe ( 'test form io#putWithoutKey' , function ( ) {
109115 it ( 'test form io#putWithoutKey' , function ( done ) {
110- var key = null ;
111- formUploader . put ( uploadToken , key , "hello world" , putExtra ,
116+ formUploader . putWithoutKey ( uploadToken , "hello world" ,
117+ putExtra ,
112118 function ( respErr ,
113119 respBody , respInfo ) {
114120 //console.log(respBody);
115121 should . not . exist ( respErr ) ;
116122 respBody . should . have . keys ( 'key' , 'hash' ) ;
117- keysToDelete . push ( respBody . key ) ;
123+ if ( ! keysToDelete . includes ( respBody . key ) ) {
124+ keysToDelete . push ( respBody . key ) ;
125+ }
118126 done ( ) ;
119127 } ) ;
120128 } ) ;
@@ -123,30 +131,34 @@ describe('test form io', function() {
123131 describe ( 'test form io#putFile' , function ( ) {
124132 it ( 'test form io#putFile' , function ( done ) {
125133 var key = 'io_putFile_test' + Math . random ( 1000 ) ;
126- formUploader . put ( uploadToken , key , imageFile , putExtra ,
134+ formUploader . putFile ( uploadToken , key , imageFile , putExtra ,
127135 function (
128136 respErr ,
129137 respBody , respInfo ) {
130138 //console.log(respBody);
131139 should . not . exist ( respErr ) ;
132140 respBody . should . have . keys ( 'key' , 'hash' ) ;
133- keysToDelete . push ( respBody . key ) ;
141+ if ( ! keysToDelete . includes ( respBody . key ) ) {
142+ keysToDelete . push ( respBody . key ) ;
143+ }
134144 done ( ) ;
135145 } ) ;
136146 } ) ;
137147 } ) ;
138148
139149 describe ( 'test form io#putFileWithoutKey' , function ( ) {
140150 it ( 'test form io#putFileWithoutKey' , function ( done ) {
141- var key = null ;
142- formUploader . put ( uploadToken , key , imageFile , putExtra ,
151+ formUploader . putFileWithoutKey ( uploadToken , imageFile ,
152+ putExtra ,
143153 function (
144154 respErr ,
145155 respBody , respInfo ) {
146156 //console.log(respBody);
147157 should . not . exist ( respErr ) ;
148158 respBody . should . have . keys ( 'key' , 'hash' ) ;
149- keysToDelete . push ( respBody . key ) ;
159+ if ( ! keysToDelete . includes ( respBody . key ) ) {
160+ keysToDelete . push ( respBody . key ) ;
161+ }
150162 done ( ) ;
151163 } ) ;
152164 } ) ;
0 commit comments