Navigation Menu

Skip to content

Commit

Permalink
Use only one command for each test
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 9, 2012
1 parent 75175f2 commit ca4fb3c
Showing 1 changed file with 31 additions and 58 deletions.
89 changes: 31 additions & 58 deletions test/gcs-commands.test.js
Expand Up @@ -45,10 +45,8 @@ suite('gcs-create-domain', function() {
});

test('create again', function(done) {
new Domain('test', context).createSync();
utils
.run('gcs-create-domain',
'--domain-name', 'test',
'--database-path', temporaryDatabase.path)
.run('gcs-create-domain',
'--domain-name', 'test',
'--database-path', temporaryDatabase.path)
Expand Down Expand Up @@ -99,10 +97,8 @@ suite('gcs-delete-domain', function() {
teardown(commonTeardown);

test('delete force', function(done) {
new Domain('test', context).createSync();
utils
.run('gcs-create-domain',
'--domain-name', 'test',
'--database-path', temporaryDatabase.path)
.run('gcs-delete-domain',
'--domain-name', 'test',
'--force',
Expand Down Expand Up @@ -181,13 +177,9 @@ suite('gcs-describe-domain', function() {
}

test('describe one', function(done) {
new Domain('domain2', context).createSync();
new Domain('domain1', context).createSync();
utils
.run('gcs-create-domain',
'--domain-name', 'domain2',
'--database-path', temporaryDatabase.path)
.run('gcs-create-domain',
'--domain-name', 'domain1',
'--database-path', temporaryDatabase.path)
.run('gcs-describe-domain',
'--domain-name', 'domain1',
'--database-path', temporaryDatabase.path)
Expand All @@ -204,13 +196,9 @@ suite('gcs-describe-domain', function() {
});

test('describe all', function(done) {
new Domain('domain2', context).createSync();
new Domain('domain1', context).createSync();
utils
.run('gcs-create-domain',
'--domain-name', 'domain2',
'--database-path', temporaryDatabase.path)
.run('gcs-create-domain',
'--domain-name', 'domain1',
'--database-path', temporaryDatabase.path)
.run('gcs-describe-domain',
'--show-all',
'--database-path', temporaryDatabase.path)
Expand All @@ -234,6 +222,7 @@ suite('gcs-configure-fields', function() {
teardown(commonTeardown);

function testCreateField(done, name, type) {
new Domain('companies', context).createSync();
utils
.run('gcs-create-domain',
'--domain-name', 'companies',
Expand Down Expand Up @@ -275,15 +264,12 @@ suite('gcs-configure-fields', function() {
});

function testDeleteField(done, name, type) {
var domain = new Domain('companies', context);
domain.createSync();
var field = domain.getIndexField(name);
field.type = type
field.createSync();
utils
.run('gcs-create-domain',
'--domain-name', 'companies',
'--database-path', temporaryDatabase.path)
.run('gcs-configure-fields',
'--domain-name', 'companies',
'--name', name,
'--type', type,
'--database-path', temporaryDatabase.path)
.run('gcs-configure-fields',
'--domain-name', 'companies',
'--name', name,
Expand Down Expand Up @@ -319,15 +305,12 @@ suite('gcs-configure-fields', function() {
});

function testRecreateField(done, name, type) {
var domain = new Domain('companies', context);
domain.createSync();
var field = domain.getIndexField(name);
field.type = type
field.createSync();
utils
.run('gcs-create-domain',
'--domain-name', 'companies',
'--database-path', temporaryDatabase.path)
.run('gcs-configure-fields',
'--domain-name', 'companies',
'--name', name,
'--type', type,
'--database-path', temporaryDatabase.path)
.run('gcs-configure-fields',
'--domain-name', 'companies',
'--name', name,
Expand Down Expand Up @@ -357,10 +340,8 @@ suite('gcs-configure-fields', function() {
});

test('delete not-existing field', function(done) {
new Domain('companies', context).createSync();
utils
.run('gcs-create-domain',
'--domain-name', 'companies',
'--database-path', temporaryDatabase.path)
.run('gcs-configure-fields',
'--domain-name', 'companies',
'--name', 'name',
Expand All @@ -380,10 +361,8 @@ suite('gcs-configure-fields', function() {
});

test('create field without type', function(done) {
new Domain('companies', context).createSync();
utils
.run('gcs-create-domain',
'--domain-name', 'companies',
'--database-path', temporaryDatabase.path)
.run('gcs-configure-fields',
'--domain-name', 'companies',
'--name', 'name',
Expand Down Expand Up @@ -476,25 +455,19 @@ suite('gcs-index-documents', function() {
teardown(commonTeardown);

test('reindex', function(done) {
var domain = new Domain('companies', context);
domain.createSync();
var textField = domain.getIndexField('name');
textField.type = 'text'
textField.createSync();
var uintField = domain.getIndexField('age');
uintField.type = 'uint'
uintField.createSync();
var literalField = domain.getIndexField('product');
literalField.type = 'literal'
literalField.createSync();

utils
.run('gcs-create-domain',
'--domain-name', 'companies',
'--database-path', temporaryDatabase.path)
.run('gcs-configure-fields',
'--domain-name', 'companies',
'--name', 'name',
'--type', 'text',
'--database-path', temporaryDatabase.path)
.run('gcs-configure-fields',
'--domain-name', 'companies',
'--name', 'age',
'--type', 'uint',
'--database-path', temporaryDatabase.path)
.run('gcs-configure-fields',
'--domain-name', 'companies',
'--name', 'product',
'--type', 'literal',
'--database-path', temporaryDatabase.path)
.run('gcs-index-documents',
'--domain-name', 'companies',
'--database-path', temporaryDatabase.path)
Expand Down

0 comments on commit ca4fb3c

Please sign in to comment.