All files models.js

100% Statements 11/11
100% Branches 6/6
100% Functions 2/2
100% Lines 7/7

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        6x   4x 2x   2x 1x     3x 2x                
export default {
  rxdb: true,
  prototypes: {
    RxDatabase(proto) {
      Object.assign(proto, {
        models(models) {
          if (Array.isArray(models)) {
            if (!models.length) return Promise.resolve(this);
          } else {
            if (!models) return Promise.resolve(this);
            else models = [models];
          }
 
          const collections = models.map((model) => this.collection(model));
          return Promise.all(collections).then(() => this);
        }
      });
    }
  },
  overwritable: {},
  hooks: {}
};