File tree Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -293,25 +293,26 @@ adapters.forEach(function (adapter) {
293
293
( { rev } ) => ( { toString :( ) => rev , indexOf :( ) => 12 , substring :'hi' } ) ,
294
294
( { rev } ) => ( { toString :( ) => rev , indexOf :( ) => 12 , substring :( ) => 'hi' } ) ,
295
295
] . forEach ( ( generateRev , idx ) => {
296
- it ( `Modify a doc with illegal rev value #${ idx } ` , function ( done ) {
297
- var db = new PouchDB ( dbs . name ) ;
298
- db . post ( { test : 'somestuff' } , function ( err , info ) {
299
- var nDoc = {
296
+ it ( `Modify a doc with illegal rev value #${ idx } ` , async ( ) => {
297
+ const db = new PouchDB ( dbs . name ) ;
298
+
299
+ const info = await db . post ( { test : 'somestuff' } ) ;
300
+
301
+ let threw ;
302
+ try {
303
+ await db . put ( {
300
304
_id : info . id ,
301
305
_rev : generateRev ( info ) ,
302
306
another : 'test'
303
- } ;
304
- db . put ( nDoc , function ( err ) {
305
- try {
306
- should . exist ( err ) ;
307
- should . exist ( err . message ) ;
308
- err . message . should . equal ( 'Invalid rev format' ) ; // TODO should be err.reason?
309
- done ( ) ;
310
- } catch ( err ) {
311
- done ( err ) ;
312
- }
313
307
} ) ;
314
- } ) ;
308
+ } catch ( err ) {
309
+ threw = true ;
310
+ err . message . should . equal ( 'Invalid rev format' ) ; // TODO should be err.reason?
311
+ }
312
+
313
+ if ( ! threw ) {
314
+ throw new Error ( 'db.put() should have thrown.' ) ;
315
+ }
315
316
} ) ;
316
317
} ) ;
317
318
You can’t perform that action at this time.
0 commit comments