[Code Style] Run gulp fixstyle
...to apply code style settings from #142.
This commit is contained in:
@@ -27,7 +27,9 @@ define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
var ZERO = function () { return 0; },
|
||||
var ZERO = function () {
|
||||
return 0;
|
||||
},
|
||||
EMPTY_SERIES = {
|
||||
getPointCount: ZERO,
|
||||
getDomainValue: ZERO,
|
||||
|
||||
@@ -176,7 +176,7 @@ define(
|
||||
"telemetry"
|
||||
)).then(function (result) {
|
||||
var head = domainObject.hasCapability("telemetry") ?
|
||||
[ domainObject ] : [],
|
||||
[domainObject] : [],
|
||||
tail = result || [];
|
||||
return head.concat(tail);
|
||||
});
|
||||
|
||||
@@ -45,7 +45,7 @@ define(
|
||||
*/
|
||||
TelemetryDelegator.prototype.promiseTelemetryObjects = function (domainObject) {
|
||||
var $q = this.$q;
|
||||
|
||||
|
||||
// If object has been cleared, there are no relevant
|
||||
// telemetry-providing domain objects.
|
||||
if (!domainObject) {
|
||||
@@ -59,7 +59,7 @@ define(
|
||||
"telemetry"
|
||||
)).then(function (result) {
|
||||
var head = domainObject.hasCapability("telemetry") ?
|
||||
[ domainObject ] : [],
|
||||
[domainObject] : [],
|
||||
tail = result || [];
|
||||
return head.concat(tail);
|
||||
});
|
||||
|
||||
@@ -37,22 +37,22 @@ define(
|
||||
function TelemetryQueue() {
|
||||
// General approach here:
|
||||
// * Maintain a queue as an array of objects containing key-value
|
||||
// pairs. Putting values into the queue will assign to the
|
||||
// earliest-available queue position for the associated key
|
||||
// pairs. Putting values into the queue will assign to the
|
||||
// earliest-available queue position for the associated key
|
||||
// (appending to the array if necessary.)
|
||||
// * Maintain a set of counts for each key, such that determining
|
||||
// the next available queue position is easy; O(1) insertion.
|
||||
// * When retrieving objects, pop off the queue and decrement
|
||||
// * When retrieving objects, pop off the queue and decrement
|
||||
// counts. This provides O(n+k) or O(k) retrieval for a queue
|
||||
// of length n with k unique keys; this depends on whether
|
||||
// the browser's implementation of Array.prototype.shift is
|
||||
// O(n) or O(1).
|
||||
|
||||
|
||||
// Graphically (indexes at top, keys along side, values as *'s),
|
||||
// if we have a queue that looks like:
|
||||
// 0 1 2 3 4
|
||||
// a * * * * *
|
||||
// b * *
|
||||
// b * *
|
||||
// c * * *
|
||||
//
|
||||
// And we put a new value for b, we expect:
|
||||
|
||||
@@ -41,7 +41,7 @@ define(
|
||||
function mockProvider(key, index) {
|
||||
var provider = jasmine.createSpyObj(
|
||||
"provider" + index,
|
||||
[ "requestTelemetry", "subscribe" ]
|
||||
["requestTelemetry", "subscribe"]
|
||||
),
|
||||
unsubscribe = jasmine.createSpy("unsubscribe" + index);
|
||||
provider.requestTelemetry.andReturn({ someKey: key });
|
||||
@@ -53,11 +53,11 @@ define(
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockQ = jasmine.createSpyObj("$q", [ "all" ]);
|
||||
mockQ = jasmine.createSpyObj("$q", ["all"]);
|
||||
mockQ.all.andReturn(mockPromise([]));
|
||||
|
||||
mockUnsubscribes = [];
|
||||
mockProviders = [ "a", "b", "c" ].map(mockProvider);
|
||||
mockProviders = ["a", "b", "c"].map(mockProvider);
|
||||
|
||||
aggregator = new TelemetryAggregator(mockQ, mockProviders);
|
||||
});
|
||||
@@ -121,4 +121,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -49,11 +49,11 @@ define(
|
||||
mockLog = jasmine.createSpyObj("$log", ["warn", "info", "debug"]);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getId", "getCapability", "getModel" ]
|
||||
["getId", "getCapability", "getModel"]
|
||||
);
|
||||
mockTelemetryService = jasmine.createSpyObj(
|
||||
"telemetryService",
|
||||
[ "requestTelemetry", "subscribe" ]
|
||||
["requestTelemetry", "subscribe"]
|
||||
);
|
||||
mockReject = jasmine.createSpyObj("reject", ["then"]);
|
||||
mockUnsubscribe = jasmine.createSpy("unsubscribe");
|
||||
@@ -119,7 +119,9 @@ define(
|
||||
it("provides an empty series when telemetry is missing", function () {
|
||||
var series;
|
||||
mockTelemetryService.requestTelemetry.andReturn(mockPromise({}));
|
||||
telemetry.requestData({}).then(function (s) { series = s; });
|
||||
telemetry.requestData({}).then(function (s) {
|
||||
series = s;
|
||||
});
|
||||
expect(series.getPointCount()).toEqual(0);
|
||||
});
|
||||
|
||||
@@ -147,7 +149,9 @@ define(
|
||||
|
||||
|
||||
it("warns if no telemetry service can be injected", function () {
|
||||
mockInjector.get.andCallFake(function () { throw ""; });
|
||||
mockInjector.get.andCallFake(function () {
|
||||
throw "";
|
||||
});
|
||||
|
||||
// Verify precondition
|
||||
expect(mockLog.warn).not.toHaveBeenCalled();
|
||||
|
||||
@@ -45,9 +45,9 @@ define(
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
[ "$on", "$broadcast", "$watch" ]
|
||||
["$on", "$broadcast", "$watch"]
|
||||
);
|
||||
mockQ = jasmine.createSpyObj("$q", [ "all", "when" ]);
|
||||
mockQ = jasmine.createSpyObj("$q", ["all", "when"]);
|
||||
mockTimeout = jasmine.createSpy("$timeout");
|
||||
mockLog = jasmine.createSpyObj("$log", ["warn", "info", "debug"]);
|
||||
|
||||
@@ -64,7 +64,7 @@ define(
|
||||
|
||||
mockTelemetry = jasmine.createSpyObj(
|
||||
"telemetry",
|
||||
[ "requestData", "subscribe", "getMetadata" ]
|
||||
["requestData", "subscribe", "getMetadata"]
|
||||
);
|
||||
mockUnsubscribe = jasmine.createSpy("unsubscribe");
|
||||
|
||||
@@ -239,4 +239,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -71,7 +71,9 @@ define(
|
||||
mockQ.all.andCallFake(function (values) {
|
||||
return values.map(function (v) {
|
||||
var r;
|
||||
asPromise(v).then(function (value) { r = value; });
|
||||
asPromise(v).then(function (value) {
|
||||
r = value;
|
||||
});
|
||||
return r;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -71,4 +71,4 @@ define(
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -40,7 +40,7 @@ define(
|
||||
mockTimeout = jasmine.createSpy("$timeout");
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getCapability", "useCapability", "hasCapability" ]
|
||||
["getCapability", "useCapability", "hasCapability"]
|
||||
);
|
||||
mockCallback = jasmine.createSpy("callback");
|
||||
mockPromise = jasmine.createSpyObj("promise", ["then"]);
|
||||
@@ -70,4 +70,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -52,7 +52,7 @@ define(
|
||||
mockTimeout = jasmine.createSpy("$timeout");
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
"domainObject",
|
||||
[ "getCapability", "useCapability", "hasCapability", "getId" ]
|
||||
["getCapability", "useCapability", "hasCapability", "getId"]
|
||||
);
|
||||
mockCallback = jasmine.createSpy("callback");
|
||||
mockTelemetry = jasmine.createSpyObj(
|
||||
@@ -67,7 +67,7 @@ define(
|
||||
mockUnlisten = jasmine.createSpy("unlisten");
|
||||
mockSeries = jasmine.createSpyObj(
|
||||
"series",
|
||||
[ "getPointCount", "getDomainValue", "getRangeValue" ]
|
||||
["getPointCount", "getDomainValue", "getRangeValue"]
|
||||
);
|
||||
|
||||
mockQ.when.andCallFake(mockPromise);
|
||||
@@ -223,7 +223,7 @@ define(
|
||||
subscription.promiseTelemetryObjects().then(mockCallback2);
|
||||
|
||||
expect(mockCallback2)
|
||||
.toHaveBeenCalledWith([ mockDomainObject ]);
|
||||
.toHaveBeenCalledWith([mockDomainObject]);
|
||||
});
|
||||
|
||||
it("reinitializes on mutation", function () {
|
||||
@@ -252,8 +252,8 @@ define(
|
||||
mockSeries.getDomainValue.andCallFake(lookup);
|
||||
mockSeries.getRangeValue.andCallFake(lookup);
|
||||
|
||||
testMetadata.domains = [ { key: 'a' }, { key: 'b'} ];
|
||||
testMetadata.ranges = [ { key: 'c' }, { key: 'd'} ];
|
||||
testMetadata.domains = [{ key: 'a' }, { key: 'b'}];
|
||||
testMetadata.ranges = [{ key: 'c' }, { key: 'd'}];
|
||||
|
||||
mockTelemetry.subscribe.mostRecentCall.args[0](mockSeries);
|
||||
mockTimeout.mostRecentCall.args[0]();
|
||||
|
||||
@@ -69,4 +69,4 @@ define(
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user