<commit_before>var Loveseat = require('../index.js').Loveseat,
  assert = require('assert'),
  db;

assert.doesNotThrow(function () {
  db = new Loveseat();
});

db.create(function (err, res) {
  assert.ok(!err);
  db.check(function (err, res) {
    assert.ok(!err);
    assert.equal(res.db_name, 'test');
    doNext();
  });
});
function doNext() {
  db.insert({ "hello": "world" }, function (err, res) {
    var id = res.id, rev = res.rev;
    assert.ok(id && rev);
    db.get(id, function (err, res) {
      assert.equal(res.hello, "world");
      db.insert(id, { "hello": "dolly", "_rev": rev }, function (err, res) {
        assert.ok(res.ok);
        rev = res.rev;
        db.get(id, function (err, res) {
          assert.equal(res.hello, "dolly");
          db.destroy(id, res._rev, function (err, res) {
            assert.ok(res.ok);
            db.get(id, function (err, res) {
              assert.equal(res.error, "not_found");
              assert.equal(res.reason, "deleted");
              doLast();
            });
          });
        });
      });
    });
  });

}
function doLast() {
  db.insert('loveseat-test', { "hey": "now" }, function (err, res) {
    var rev = res.rev;
    assert.ok(rev);
    db.get('loveseat-test', function (err, res) {
      assert.equal(res.hey, "now");
      db.destroy('loveseat-test', rev);
    });
  });<commit_msg>minor test rewrite<commit_after>var Loveseat = require('../index.js').Loveseat,
  assert = require('assert'),
  db;

assert.doesNotThrow(function () {
  db = new Loveseat();
});

db.create(function (err, res) {
  assert.ok(!err);
  db.check(function (err, res) {
    assert.ok(!err);
    doNext();
  });
});
function doNext() {
  db.insert({ hello: 'world' }, function (err, res) {
    var id = res.id, rev = res.rev;
    assert.ok(id && rev);
    db.get(id, function (err, res) {
      assert.equal(res.hello, 'world');
      db.insert(id, { hello: 'dolly', '_rev': rev }, function (err, res) {
        assert.ok(res.ok);
        rev = res.rev;
        db.get(id, function (err, res) {
          assert.equal(res.hello, 'dolly');
          db.destroy(id, res._rev, function (err, res) {
            assert.ok(res.ok);
            db.get(id, function (err, res) {
              assert.equal(res.error, 'not_found');
              assert.equal(res.reason, 'deleted');
              doLast();
            });
          });
        });
      });
    });
  });

}
function doLast() {
  db.insert('loveseat-test', { hey: 'now' }, function (err, res) {
    var rev = res.rev;
    assert.ok(rev);
    db.get('loveseat-test', function (err, res) {
      assert.equal(res.hey, 'now');
      db.destroy('loveseat-test', rev);
    });
  });
{'fraction_non_alphanumeric': 0.20014825796886582, 'fraction_numerical': 0.0, 'mean_word_length': 2.279465370595383, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7504942', 'n_tokens_mistral': 952, 'n_tokens_neox': 946, 'n_words': 188}