var testDatabase = require('./util/database');
var db = require('../')(testDatabase.url);
var uniqn = require('./util/ponies').uniqn;

var assert = require('assert');
var async = require('async');

describe('seraph#constraints', function() {
  it('should be able to add a uniqueness constraint', function(done) {
    var label = uniqn();
    db.constraints.uniqueness.create(label, 'name', function(err, constraint) {
      assert(!err);
      assert.equal(constraint.label, label);
      assert.equal(constraint.type, 'UNIQUENESS');
      assert.equal(constraint.property_keys.length, 1);
      assert.equal(constraint.property_keys[0], 'name');
      done();
    });
  });
});

@@ -667,13 +667,666 @@
 );%0A  %7D);
+%0A%0A  it('should make effective uniqueness constraints', function(done) %7B%0A    var label = uniqn();%0A    db.constraints.uniqueness.create(label, 'name', function(err) %7B%0A      assert(!err);%0A      db.save(%7Bname:'jon'%7D, function(err, node) %7B%0A        assert(!err);%0A        db.label(node, label, function(err) %7B%0A          assert(!err);%0A          db.save(%7Bname:'jon'%7D, function(err, node) %7B%0A            assert(!err);%0A            db.label(node, label, function(err) %7B%0A              assert(err);%0A              assert(err.neo4jCause.exception == 'ConstraintViolationException');%0A              done();%0A            %7D);%0A          %7D);%0A        %7D);%0A      %7D);%0A    %7D);%0A  %7D);
 %0A%7D);%0A

add test checking if uniqueness constraints are effective