@@ -23,11 +23,11 @@ describe('pouchdb-find: test.kitchen-sink-2.js', function () {
2323
2424 const context = { } ;
2525
26- before ( function ( ) {
26+ before ( async function ( ) {
2727 this . timeout ( 60000 ) ;
2828 context . db = new PouchDB ( dbName ) ;
2929
30- return context . db . bulkDocs ( [
30+ await context . db . bulkDocs ( [
3131 { name : 'mario' , _id : 'mario' , rank : 5 , series : 'mario' , debut : 1981 } ,
3232 { name : 'jigglypuff' , _id : 'puff' , rank : 8 , series : 'pokemon' , debut : 1996 } ,
3333 { name : 'link' , rank : 10 , _id : 'link' , series : 'zelda' , debut : 1986 } ,
@@ -40,28 +40,28 @@ describe('pouchdb-find: test.kitchen-sink-2.js', function () {
4040 { name : 'samus' , rank : 12 , _id : 'samus' , series : 'metroid' , debut : 1986 } ,
4141 { name : 'yoshi' , _id : 'yoshi' , rank : 6 , series : 'mario' , debut : 1990 } ,
4242 { name : 'kirby' , _id : 'kirby' , series : 'kirby' , rank : 2 , debut : 1992 }
43- ] ) . then ( ( ) => {
44- // This could be done by Promise.all, but for now that breaks IDBNext.
45- // Promise.all index creation is tested explicitly in test.ddoc.js
46- const indexes = [
47- { index : { fields : [ 'rank' ] } } ,
48- { index : { fields : [ 'series ' ] } } ,
49- { index : { fields : [ 'debut ' ] } } ,
50- { index : { fields : [ 'name ' ] } } ,
51- { index : { fields : [ 'name' , 'rank '] } } ,
52- { index : { fields : [ 'name' , 'series ' ] } } ,
53- { index : { fields : [ 'series ' , 'debut' , 'rank '] } } ,
54- { index : { fields : [ 'rank ' , 'debut' ] } } ,
55- ] ;
56-
57- return indexes . reduce ( ( p , index ) => {
58- return p . then ( ( ) => context . db . createIndex ( index ) ) ;
59- } , Promise . resolve ( ) ) ;
60- } ) ;
43+ ] ) ;
44+
45+ // This could be done by Promise.all, but for now that breaks IDBNext.
46+ // Promise.all index creation is tested explicitly in test.ddoc.js
47+ const indexes = [
48+ { index : { fields : [ 'rank ' ] } } ,
49+ { index : { fields : [ 'series ' ] } } ,
50+ { index : { fields : [ 'debut ' ] } } ,
51+ { index : { fields : [ 'name' ] } } ,
52+ { index : { fields : [ 'name' , 'rank ' ] } } ,
53+ { index : { fields : [ 'name ' , 'series ' ] } } ,
54+ { index : { fields : [ 'series ' , 'debut' , 'rank '] } } ,
55+ { index : { fields : [ 'rank' , 'debut' ] } } ,
56+ ] ;
57+
58+ for ( const index of indexes ) {
59+ await context . db . createIndex ( index ) ;
60+ }
6161 } ) ;
62- after ( function ( ) {
62+ after ( async function ( ) {
6363 this . timeout ( 60000 ) ;
64- return context . db . destroy ( ) ;
64+ await context . db . destroy ( ) ;
6565 } ) ;
6666
6767 // to actually generate the list:
0 commit comments