Update test specs to use Jasmine 3 (#2089)

* Updated Karma and Jasmine versions

* Added DOMObserver class. Supports promise-based testing of DOM changes

Update asynchronous test specs to use promises or done() instead of waitsFor/runs

* Modified ActionCapability to duplicate context object properties as own properties for better object equality comparisons

* Global find + replace to fix syntax issues

* Fixed various issues caused by non-deterministic runtime order of tests in Jasmine 3. Fixed issues caused by changes to determination of object equality

* Addressed review comments

* Resolved merge conflicts with master

* Fixed style errors

* Use spy.calls.count() instead of manually tracking
This commit is contained in:
Andrew Henry
2018-06-29 17:32:59 -07:00
committed by Pete Richards
parent 013eba744d
commit 433dee0314
305 changed files with 2866 additions and 3324 deletions

View File

@@ -68,7 +68,7 @@ define(
mockCallback = jasmine.createSpy('callback');
// Simulate $q.all, at least for asPromise-provided promises
mockQ.all.andCallFake(function (values) {
mockQ.all.and.callFake(function (values) {
return values.map(function (v) {
var r;
asPromise(v).then(function (value) {
@@ -77,14 +77,14 @@ define(
return r;
});
});
mockQ.when.andCallFake(asPromise);
mockQ.when.and.callFake(asPromise);
mockSubscription.getTelemetryObjects
.andReturn([mockDomainObject]);
.and.returnValue([mockDomainObject]);
mockSubscription.promiseTelemetryObjects
.andReturn(asPromise([mockDomainObject]));
mockDomainObject.getId.andReturn('testId');
mockDomainObject.getCapability.andReturn(mockTelemetry);
mockTelemetry.requestData.andReturn(asPromise(mockSeries));
.and.returnValue(asPromise([mockDomainObject]));
mockDomainObject.getId.and.returnValue('testId');
mockDomainObject.getCapability.and.returnValue(mockTelemetry);
mockTelemetry.requestData.and.returnValue(asPromise(mockSeries));
handle = new TelemetryHandle(mockQ, mockSubscription);
});
@@ -121,7 +121,7 @@ define(
it("provides access to the datum objects by index", function () {
var testDatum = { a: 1, b: 2 }, testIndex = 42;
mockSubscription.makeDatum.andReturn(testDatum);
mockSubscription.makeDatum.and.returnValue(testDatum);
handle.request({});
expect(handle.getDatum(mockDomainObject, testIndex))
.toEqual(testDatum);