[Search] Update field name

Update field name in GenericSearchProvider to reflect changes
from nasa/openmctweb#193. Avoids exceptions on mutation.

Additionally, add test case exercising relevant code and verifying
that reindexing is scheduled upon mutation as expected.
This commit is contained in:
Victor Woeltjen 2015-10-23 12:14:46 -07:00
parent 59f094763b
commit bf24ac7c93
2 changed files with 9 additions and 1 deletions

View File

@ -122,7 +122,7 @@ define([
mutationTopic.listen(function (mutatedObject) {
var id = mutatedObject.getId();
provider.indexed[id] = false;
provider.indexedIds[id] = false;
provider.scheduleForIndexing(id);
});
};

View File

@ -99,6 +99,14 @@ define([
.toHaveBeenCalledWith(jasmine.any(Function));
});
it('reschedules indexing when mutation occurs', function () {
var mockDomainObject =
jasmine.createSpyObj('domainObj', ['getId']);
mockDomainObject.getId.andReturn("some-id");
mutationTopic.listen.mostRecentCall.args[0](mockDomainObject);
expect(provider.scheduleForIndexing).toHaveBeenCalledWith('some-id');
});
it('starts indexing roots', function () {
expect(provider.scheduleForIndexing).toHaveBeenCalledWith('mine');
});