Code coverage report for spec/generic/collection.spec.js

Statements: 100% (14 / 14)      Branches: 50% (1 / 2)      Functions: 100% (4 / 4)      Lines: 100% (13 / 13)      Ignored: none     

All files » spec/generic/ » collection.spec.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 221   1 1 1 1   1 1 1   1   1 1 1     1      
Eif (typeof(window) === 'undefined') var loki = require('../../src/lokijs.js');
 
describe('collection', function () {
  it('works', function () {
    function SubclassedCollection() {
      loki.Collection.apply(this, Array.prototype.slice.call(arguments));
    }
    SubclassedCollection.prototype = new loki.Collection;
    SubclassedCollection.prototype.extendedMethod = function () {
      return this.name.toUpperCase();
    }
    var coll = new SubclassedCollection('users', {});
 
    expect(coll != null).toBe(true);
    expect('users'.toUpperCase()).toEqual(coll.extendedMethod());
    coll.insert({
      name: 'joe'
    });
    expect(coll.data.length).toEqual(1);
  });
});