Code coverage report for node-mongoskin/lib/grid_store.js

Statements: 95.83% (23 / 24)      Branches: 50% (1 / 2)      Functions: 100% (5 / 5)      Lines: 100% (23 / 23)      Ignored: none     

All files » node-mongoskin/lib/ » grid_store.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35    1 1   1   1 4 4 4 4 4 4 4 4       1 5 2 2 2 2         1 1 1 1 1  
"use strict";
 
var GridStore = require('mongodb').GridStore;
var makeSkinClass = require('./utils').makeSkinClass;
 
var SkinGridStore = exports.SkinGridStore = makeSkinClass(GridStore);
 
SkinGridStore.prototype._open = function(callback) {
  var skin_db = this._construct_args[0];
  var args = this._construct_args.slice(1);
  skin_db.open(function(err, p_db) {
      Iif(err) return callback(err);
      args = ([null, p_db]).concat(args);
      var ctor = GridStore.bind.apply(GridStore, args);
      var gridStore = new ctor();
      gridStore.open(callback);
  });
}
 
function bindStaticMethod(methodName) {
  SkinGridStore[methodName] = function(skindb) {
    var args = Array.prototype.slice.call(arguments);
    skindb.open(function(err, p_db) {
        args[0] = p_db;
        GridStore[methodName].apply(GridStore, args);
    });
  }
}
 
bindStaticMethod('exist');
bindStaticMethod('list');
bindStaticMethod('read');
bindStaticMethod('readlines');
bindStaticMethod('unlink');