Navigation Menu

Skip to content

Commit

Permalink
Don't compare null with object
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 14, 2012
1 parent d1cbdd0 commit ffc37d6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
15 changes: 10 additions & 5 deletions test/database-domain.test.js
Expand Up @@ -258,7 +258,8 @@ suite('database', function() {
});

test('setting default search field (instance)', function() {
assert.equal(domain.defaultSearchField, null);
assert.isTrue(domain.defaultSearchField === null,
domain.defaultSearchField);
var nameField = domain.getIndexField('name');
domain.defaultSearchField = nameField;
assert.equal(domain.defaultSearchField, nameField);
Expand All @@ -269,7 +270,8 @@ suite('database', function() {
});

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

Expand All @@ -279,9 +281,11 @@ suite('database', function() {
});

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

test('removing default search field', function() {
Expand All @@ -290,7 +294,8 @@ suite('database', function() {
assert.equal(domain.defaultSearchField, nameField);

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

var anotherDomainInstance = new Domain('companies', context);
assert.equal(anotherDomainInstance.defaultSearchField, null);
Expand Down
6 changes: 4 additions & 2 deletions test/database-index-field.test.js
Expand Up @@ -302,7 +302,8 @@ suite('database', function() {

field.defaultSearchField = true;
field.saveOptionsSync();
assert.equal(domain.defaultSearchField, null);
assert.isTrue(domain.defaultSearchField === null,
domain.defaultSearchField);
});

test('auto-remove default search field', function() {
Expand All @@ -314,7 +315,8 @@ suite('database', function() {
domain.getIndexField('product'));

field.deleteSync();
assert.equal(domain.defaultSearchField, null);
assert.isTrue(domain.defaultSearchField === null,
domain.defaultSearchField);
});
});

Expand Down

0 comments on commit ffc37d6

Please sign in to comment.