Navigation Menu

Skip to content

Commit

Permalink
Update tests for DeleteIndexField
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 2, 2012
1 parent 14c2bbd commit a799bda
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions test/api-configuration.test.js
Expand Up @@ -420,24 +420,25 @@ suite('Configuration API', function() {
});

test('Get, Action=DeleteIndexField (text)', function(done) {
var domain, field;
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
})
.get('/?DomainName=companies&IndexField.IndexFieldName=name&' +
'IndexField.IndexFieldType=text&' +
'Action=DefineIndexField&Version=2011-02-01')
.next(function() {
domain = new Domain('companies', context);
field = domain.getIndexField('name');
}),
.get('/?DomainName=companies&IndexFieldName=name&' +
'Action=DeleteIndexField&Version=2011-02-01')
.next(function(response) {
var dump = context.commandSync('dump', {
tables: 'companies'
});
var expected = 'table_create companies_00000000000000000000000000 TABLE_HASH_KEY ShortText\n' +
'table_create companies_00000000000000000000000000_BigramTerms ' +
'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
'--default_tokenizer TokenBigram';
assert.equal(dump, expected);
assert.deepEqual({ domain: domain.exists(),
field: domain.field() },
{ domain: true,
field: faldomain.field() });

response = toParsedResponse(response);
assert.deepEqual(response.pattern,
Expand All @@ -452,24 +453,25 @@ suite('Configuration API', function() {
});

test('Get, Action=DeleteIndexField (uint)', function(done) {
var domain, field;
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
})
.get('/?DomainName=companies&IndexField.IndexFieldName=age&' +
'IndexField.IndexFieldType=uint&' +
'Action=DefineIndexField&Version=2011-02-01')
.next(function() {
domain = new Domain('companies', context);
field = domain.getIndexField('age');
}),
.get('/?DomainName=companies&IndexFieldName=age&' +
'Action=DeleteIndexField&Version=2011-02-01')
.next(function(response) {
var dump = context.commandSync('dump', {
tables: 'companies'
});
var expected = 'table_create companies_00000000000000000000000000 TABLE_HASH_KEY ShortText\n' +
'table_create companies_00000000000000000000000000_BigramTerms ' +
'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
'--default_tokenizer TokenBigram';
assert.equal(dump, expected);
assert.deepEqual({ domain: domain.exists(),
field: domain.field() },
{ domain: true,
field: faldomain.field() });

response = toParsedResponse(response);
assert.deepEqual(response.pattern,
Expand All @@ -484,24 +486,25 @@ suite('Configuration API', function() {
});

test('Get, Action=DeleteIndexField (literal)', function(done) {
var domain, field;
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
})
.get('/?DomainName=companies&IndexField.IndexFieldName=member&' +
.get('/?DomainName=companies&IndexField.IndexFieldName=product&' +
'IndexField.IndexFieldType=literal&' +
'Action=DefineIndexField&Version=2011-02-01')
.get('/?DomainName=companies&IndexFieldName=member&' +
.next(function() {
domain = new Domain('companies', context);
field = domain.getIndexField('product');
}),
.get('/?DomainName=companies&IndexFieldName=product&' +
'Action=DeleteIndexField&Version=2011-02-01')
.next(function(response) {
var dump = context.commandSync('dump', {
tables: 'companies'
});
var expected = 'table_create companies_00000000000000000000000000 TABLE_HASH_KEY ShortText\n' +
'table_create companies_00000000000000000000000000_BigramTerms ' +
'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
'--default_tokenizer TokenBigram';
assert.equal(dump, expected);
assert.deepEqual({ domain: domain.exists(),
field: domain.field() },
{ domain: true,
field: faldomain.field() });

response = toParsedResponse(response);
assert.deepEqual(response.pattern,
Expand Down

0 comments on commit a799bda

Please sign in to comment.