Navigation Menu

Skip to content

Commit

Permalink
Add tests for invalid use of cs-create-domain command
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 6, 2012
1 parent cfad94e commit 2e5884b
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions test/cs-commands.test.js
Expand Up @@ -39,4 +39,43 @@ suite('cs-create-domain', function() {
done();
});
});

test('create again', function(done) {
utils
.run('cs-create-domain',
'--domain-name', 'test',
'--database-path', temporaryDatabase.path)
.run('cs-create-domain',
'--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.');

context.reopen();
var domains = Domain.getAll(context).map(function(domain) {
return domain.name;
});
assert.deepEqual(domains, ['test']);

done();
});
});

test('missing domain name', function(done) {
utils
.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.');

context.reopen();
assert.deepEqual(Domain.getAll(context), []);

done();
});
});
});

0 comments on commit 2e5884b

Please sign in to comment.