alias
also remove id since it's not useful for mailbox case (not like mailbox can be renamed and we need a fixed it)
This commit is contained in:
@@ -1127,23 +1127,22 @@ describe('database', function () {
|
||||
|
||||
describe('mailboxes', function () {
|
||||
it('add succeeds', function (done) {
|
||||
mailboxdb.add('supportid', 'support', function (error, mailbox) {
|
||||
mailboxdb.add('support', function (error, mailbox) {
|
||||
expect(error).to.be(null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('cannot add dup entry', function (done) {
|
||||
mailboxdb.add('supportid2', 'support', function (error, mailbox) {
|
||||
mailboxdb.add('support', function (error, mailbox) {
|
||||
expect(error.reason).to.be(DatabaseError.ALREADY_EXISTS);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('get succeeds', function (done) {
|
||||
mailboxdb.get('supportid', function (error, mailbox) {
|
||||
mailboxdb.get('support', function (error, mailbox) {
|
||||
expect(error).to.be(null);
|
||||
expect(mailbox.id).to.be('supportid');
|
||||
expect(mailbox.name).to.be('support');
|
||||
expect(mailbox.creationTime).to.be.a(Date);
|
||||
|
||||
@@ -1156,14 +1155,43 @@ describe('database', function () {
|
||||
expect(error).to.be(null);
|
||||
expect(results).to.be.an(Array);
|
||||
expect(results.length).to.be(1);
|
||||
expect(results[0].id).to.be('supportid');
|
||||
expect(results[0].name).to.be('support');
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('can set alias', function (done) {
|
||||
mailboxdb.setAliases('support2', [ 'support2', 'help' ], function (error) {
|
||||
expect(error).to.be(null);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('can get alias', function (done) {
|
||||
mailboxdb.getAliases('support2', function (error, results) {
|
||||
expect(error).to.be(null);
|
||||
expect(results.length).to.be(2);
|
||||
expect(results[0]).to.be('help');
|
||||
expect(results[1]).to.be('support2')
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('unset aliases', function (done) {
|
||||
mailboxdb.setAliases('support2', [ ], function (error) {
|
||||
expect(error).to.be(null);
|
||||
|
||||
mailboxdb.getAliases('support2', function (error, results) {
|
||||
expect(error).to.be(null);
|
||||
expect(results.length).to.be(0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('del succeeds', function (done) {
|
||||
mailboxdb.del('supportid', function (error) {
|
||||
mailboxdb.del('support', function (error) {
|
||||
expect(error).to.be(null);
|
||||
done();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user