[Style] JSLint compliance

This commit is contained in:
Pete Richards
2015-10-20 15:31:33 -07:00
parent fe3263fdfe
commit 77d81f899b
3 changed files with 17 additions and 13 deletions

View File

@ -31,7 +31,10 @@ define([
) { ) {
"use strict"; "use strict";
var DEFAULT_MAX_RESULTS = 100; var DEFAULT_MAX_RESULTS = 100,
ID_PROPERTY = '_id',
SOURCE_PROPERTY = '_source',
SCORE_PROPERTY = '_score';
/** /**
* A search service which searches through domain objects in * A search service which searches through domain objects in
@ -133,15 +136,15 @@ define([
var results = response.data.hits.hits, var results = response.data.hits.hits,
searchResults = results.map(function (result) { searchResults = results.map(function (result) {
return { return {
id: result['_id'], id: result[ID_PROPERTY],
model: result['_source'], model: result[SOURCE_PROPERTY],
score: result['_score'] score: result[SCORE_PROPERTY]
}; };
}); });
return { return {
hits: searchResults, hits: searchResults,
total: response.data.hits.total, total: response.data.hits.total
}; };
}; };

View File

@ -19,7 +19,8 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/*global define,describe,it,expect,beforeEach,jasmine*/ /*global define,describe,it,expect,beforeEach,jasmine,Promise,spyOn,waitsFor,
runs*/
/** /**
* SearchSpec. Created by shale on 07/31/2015. * SearchSpec. Created by shale on 07/31/2015.
@ -126,12 +127,12 @@ define([
}); });
it('tracks ids to index', function () { it('tracks ids to index', function () {
expect(provider.indexedIds['a']).not.toBeDefined(); expect(provider.indexedIds.a).not.toBeDefined();
expect(provider.pendingIndex['a']).not.toBeDefined(); expect(provider.pendingIndex.a).not.toBeDefined();
expect(provider.idsToIndex).not.toContain('a'); expect(provider.idsToIndex).not.toContain('a');
provider.scheduleForIndexing('a'); provider.scheduleForIndexing('a');
expect(provider.indexedIds['a']).toBeDefined(); expect(provider.indexedIds.a).toBeDefined();
expect(provider.pendingIndex['a']).toBeDefined(); expect(provider.pendingIndex.a).toBeDefined();
expect(provider.idsToIndex).toContain('a'); expect(provider.idsToIndex).toContain('a');
}); });
@ -214,7 +215,7 @@ define([
provider.beginIndexRequest(); provider.beginIndexRequest();
waitsFor(function () { waitsFor(function () {
return provider.pendingRequests === 0; return provider.pendingRequests === 0;
}) });
runs(function () { runs(function () {
expect(provider.index) expect(provider.index)
.toHaveBeenCalledWith('abc', models.abc); .toHaveBeenCalledWith('abc', models.abc);
@ -224,7 +225,7 @@ define([
it('does not error if no objects queued', function () { it('does not error if no objects queued', function () {
provider.idsToIndex = []; provider.idsToIndex = [];
expect(function () { expect(function () {
provider.beginIndexRequest() provider.beginIndexRequest();
}).not.toThrow(); }).not.toThrow();
}); });
}); });

View File

@ -45,7 +45,7 @@ define([
'objectService', 'objectService',
['getObjects'] ['getObjects']
); );
providers = [], providers = [];
aggregator = new SearchAggregator($q, objectService, providers); aggregator = new SearchAggregator($q, objectService, providers);
}); });