All files / src/operations remove_item.js

100% Statements 14/14
100% Branches 0/0
100% Functions 6/6
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23    1x 1x 2x   1x     1x 1x 1x 3x 3x 6x 3x       1x      
export default {
  single: ({ key, stores, log }) => {
    log(`Remove Single`)
    log(`"${key}"`)
    stores.forEach(store => store.remove(key))
 
    return { key }
  },
  multi: ({ keys, stores, log }) => {
    log(`Remove Multi`)
    const promises = []
    keys.forEach(key => {
      promises.push(new Promise(resolve => {
        log(`"${key}"`)
        stores.forEach(store => store.remove(key))
        resolve(key)
      }))
    })
 
    return Promise.all(promises)
  }
}