Navigation Menu

Skip to content

Commit

Permalink
Fix tests around Domain#defaultSearchField
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 14, 2012
1 parent ffc37d6 commit c241a78
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions test/database-domain.test.js
Expand Up @@ -255,50 +255,50 @@ suite('database', function() {
}
assert.deepEqual(fields.sort(sortFields), expected.sort(sortFields));
});
});

test('setting default search field (instance)', function() {
assert.isTrue(domain.defaultSearchField === null,
domain.defaultSearchField);
var nameField = domain.getIndexField('name');
domain.defaultSearchField = nameField;
assert.equal(domain.defaultSearchField, nameField);
test('setting default search field (instance)', function() {
assert.isTrue(domain.defaultSearchField === null,
domain.defaultSearchField);
var nameField = domain.getIndexField('name');
domain.defaultSearchField = nameField;
assert.equal(domain.defaultSearchField, nameField);

var anotherDomainInstance = new Domain('companies', context);
assert.equal(anotherDomainInstance.defaultSearchField,
anotherDomainInstance.getIndexField('name'));
});
var anotherDomainInstance = new Domain('companies', context);
assert.equal(anotherDomainInstance.defaultSearchField,
anotherDomainInstance.getIndexField('name'));
});

test('setting default search field (text)', function() {
assert.isTrue(domain.defaultSearchField === null,
domain.defaultSearchField);
domain.defaultSearchField = 'name';
assert.equal(domain.defaultSearchField, domain.getIndexField('name'));
test('setting default search field (text)', function() {
assert.isTrue(domain.defaultSearchField === null,
domain.defaultSearchField);
domain.defaultSearchField = 'name';
assert.equal(domain.defaultSearchField, domain.getIndexField('name'));

var anotherDomainInstance = new Domain('companies', context);
assert.equal(anotherDomainInstance.defaultSearchField,
anotherDomainInstance.getIndexField('name'));
});
var anotherDomainInstance = new Domain('companies', context);
assert.equal(anotherDomainInstance.defaultSearchField,
anotherDomainInstance.getIndexField('name'));
});

test('setting default search field (unknown field)', function() {
assert.isTrue(domain.defaultSearchField === null,
domain.defaultSearchField);
domain.defaultSearchField = 'unknown';
assert.isTrue(domain.defaultSearchField === null,
domain.defaultSearchField);
});
test('setting default search field (unknown field)', function() {
assert.isTrue(domain.defaultSearchField === null,
domain.defaultSearchField);
domain.defaultSearchField = 'unknown';
assert.isTrue(domain.defaultSearchField === null,
domain.defaultSearchField);
});

test('removing default search field', function() {
var nameField = domain.getIndexField('name');
domain.defaultSearchField = nameField;
assert.equal(domain.defaultSearchField, nameField);
test('removing default search field', function() {
var nameField = domain.getIndexField('name');
domain.defaultSearchField = nameField;
assert.equal(domain.defaultSearchField, nameField);

domain.defaultSearchField = null;
assert.isTrue(domain.defaultSearchField === null,
domain.defaultSearchField);
domain.defaultSearchField = null;
assert.isTrue(domain.defaultSearchField === null,
domain.defaultSearchField);

var anotherDomainInstance = new Domain('companies', context);
assert.equal(anotherDomainInstance.defaultSearchField, null);
var anotherDomainInstance = new Domain('companies', context);
assert.equal(anotherDomainInstance.defaultSearchField, null);
});
});

suite('database modifications', function() {
Expand Down

0 comments on commit c241a78

Please sign in to comment.