From bf24ac7c933fb14cb9bd108e9b1b50070ac8a507 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 23 Oct 2015 12:14:46 -0700 Subject: [PATCH] [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. --- platform/search/src/services/GenericSearchProvider.js | 2 +- .../search/test/services/GenericSearchProviderSpec.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index 2b99abcae2..71dfe8c0ed 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -122,7 +122,7 @@ define([ mutationTopic.listen(function (mutatedObject) { var id = mutatedObject.getId(); - provider.indexed[id] = false; + provider.indexedIds[id] = false; provider.scheduleForIndexing(id); }); }; diff --git a/platform/search/test/services/GenericSearchProviderSpec.js b/platform/search/test/services/GenericSearchProviderSpec.js index 7b8e52274b..cc80e4210d 100644 --- a/platform/search/test/services/GenericSearchProviderSpec.js +++ b/platform/search/test/services/GenericSearchProviderSpec.js @@ -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'); });