more tests

This commit is contained in:
Barış Soner Uşaklı
2017-05-19 20:24:54 -04:00
parent 77894915eb
commit fd0043f36a
5 changed files with 201 additions and 103 deletions

View File

@@ -9,11 +9,18 @@ describe('List methods', function () {
describe('listAppend()', function () {
it('should append to a list', function (done) {
db.listAppend('testList1', 5, function (err) {
assert.equal(err, null);
assert.ifError(err);
assert.equal(arguments.length, 1);
done();
});
});
it('should not add anyhing if key is falsy', function (done) {
db.listAppend(null, 3, function (err) {
assert.ifError(err);
done();
});
});
});
describe('listPrepend()', function () {
@@ -38,6 +45,13 @@ describe('List methods', function () {
done();
});
});
it('should not add anyhing if key is falsy', function (done) {
db.listPrepend(null, 3, function (err) {
assert.ifError(err);
done();
});
});
});
describe('getListRange()', function () {
@@ -83,6 +97,14 @@ describe('List methods', function () {
done();
});
});
it('should not get anyhing if key is falsy', function (done) {
db.getListRange(null, 0, -1, function (err, data) {
assert.ifError(err);
assert.equal(data, undefined);
done();
});
});
});
describe('listRemoveLast()', function () {
@@ -105,6 +127,13 @@ describe('List methods', function () {
done();
});
});
it('should not remove anyhing if key is falsy', function (done) {
db.listRemoveLast(null, function (err) {
assert.ifError(err);
done();
});
});
});
describe('listRemoveAll()', function () {
@@ -132,6 +161,13 @@ describe('List methods', function () {
});
});
});
it('should not remove anyhing if key is falsy', function (done) {
db.listRemoveAll(null, 3, function (err) {
assert.ifError(err);
done();
});
});
});
describe('listTrim()', function () {
@@ -156,6 +192,13 @@ describe('List methods', function () {
});
});
});
it('should not add anyhing if key is falsy', function (done) {
db.listTrim(null, 0, 3, function (err) {
assert.ifError(err);
done();
});
});
});