Navigation Menu

Skip to content

Commit

Permalink
Add test for invalid input for cs-delete-domain
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 6, 2012
1 parent 46ac3e1 commit 192d231
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions test/cs-commands.test.js
Expand Up @@ -52,9 +52,10 @@ suite('cs-create-domain', function() {
'--domain-name', 'test',
'--database-path', temporaryDatabase.path)
.next(function(result) {
assert.equal(result.code, 1);
assert.include(result.output.stdout,
'The domain [test] already exists.');
assert.deepEqual({ code: result.code,
message: result.output.stdout },
{ code: 1,
message: 'The domain [test] already exists.\n' });

context.reopen();
var domains = Domain.getAll(context).map(function(domain) {
Expand All @@ -74,9 +75,10 @@ suite('cs-create-domain', function() {
.run('cs-create-domain',
'--database-path', temporaryDatabase.path)
.next(function(result) {
assert.equal(result.code, 1);
assert.include(result.output.stdout,
'You must specify the domain name.');
assert.deepEqual({ code: result.code,
message: result.output.stdout },
{ code: 1,
message: 'You must specify the domain name.\n' });

context.reopen();
assert.deepEqual(Domain.getAll(context), []);
Expand All @@ -103,9 +105,10 @@ suite('cs-delete-domain', function() {
'--force',
'--database-path', temporaryDatabase.path)
.next(function(result) {
assert.equal(result.code, 0);
assert.include(result.output.stdout,
'Domain [test] has been deleted successfully.');
assert.deepEqual({ code: result.code,
message: result.output.stdout },
{ code: 0,
message: 'Domain [test] has been deleted successfully.\n' });

context.reopen();
var domain = new Domain('test', context);
Expand All @@ -117,6 +120,24 @@ suite('cs-delete-domain', function() {
done(e);
});
});

test('delete unexisting domain', function(done) {
utils
.run('cs-delete-domain',
'--domain-name', 'test',
'--force',
'--database-path', temporaryDatabase.path)
.next(function(result) {
assert.deepEqual({ code: result.code,
message: result.output.stdout },
{ code: 1,
message: 'You must specify the domain name\n' });
done();
})
.error(function(e) {
done(e);
});
});
});

suite('cs-describe-domain', function() {
Expand Down

0 comments on commit 192d231

Please sign in to comment.