var expect = require('chai').expect;
var treo = require('../lib/treo');

describe('treo', function() {
  var db;
  var schema = treo.schema()
    .version(1)
      .addStore('books')
      .addIndex('byTitle', 'title', { unique: true })
      .addIndex('byAuthor', 'author')
    .version(2)
      .getStore('books')
      .addIndex('byYear', 'year')
    .version(3)
      .addStore('magazines')
      .addIndex('byPublisher', 'publisher')
      .addIndex('byFrequency', 'frequency');

  beforeEach(function() {
    db = treo('treo', schema);
  });

  afterEach(function(done) {
    db.drop(done);
  });

  describe('db', function() {
    it('has properties', function() {
      expect(db.name).equal('treo');
      expect(db.version).equal(3);
      expect(db.stores).length(2);
      expect(db.status).equal('close');
    });
  });

  describe('store', function() {
    it('has properties', function() {
      var books = db.store('books');
      expect(books.name).equal('books');
      expect(books.indexes).length(3);
    });
  });
});

@@ -1018,23 +1018,1001 @@
 (3);%0A    %7D);
+%0A%0A    it('#put one record', function(done) %7B%0A      var attrs = %7B title: 'Quarry Memories', author: 'Fred', isbn: 123456 %7D;%0A      var books = db.store('books');%0A%0A      books.put(attrs.isbn, attrs, function(err) %7B%0A        if (err) return done(err);%0A        books.get(attrs.isbn, function(err, book) %7B%0A          if (err) return done(err);%0A          expect(book).eql(attrs);%0A          done();%0A        %7D);%0A      %7D);%0A    %7D);%0A%0A    it('#put many record in batch', function(done) %7B%0A      var books = db.store('books');%0A      books.put(%7B%0A        123456: %7B title: 'Quarry Memories', author: 'Fred', isbn: 123456 %7D,%0A        234567: %7B title: 'Water Buffaloes', author: 'Fred', isbn: 234567 %7D,%0A        345678: %7B title: 'Bedrock Nights', author: 'Barney', isbn: 345678 %7D,%0A      %7D, function(err) %7B%0A        if (err) return done(err);%0A        books.count(function(err, count) %7B%0A          if (err) return done(err);%0A          expect(count).equal(3);%0A          done();%0A        %7D);%0A      %7D);%0A    %7D);
 %0A  %7D);%0A%7D);%0A

add tests for store.put