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

@@ -60,10 +60,10 @@ define(
['getId', 'getModel', 'getCapability', 'useCapability']
);
mockDomainObj.getId.andReturn(id);
mockDomainObj.getModel.andReturn({ composition: composition });
mockDomainObj.useCapability.andReturn(asPromise(mockTimespans[id]));
mockDomainObj.getCapability.andCallFake(function (c) {
mockDomainObj.getId.and.returnValue(id);
mockDomainObj.getModel.and.returnValue({ composition: composition });
mockDomainObj.useCapability.and.returnValue(asPromise(mockTimespans[id]));
mockDomainObj.getCapability.and.callFake(function (c) {
return {
mutation: mockMutations[id]
}[c];
@@ -84,9 +84,9 @@ define(
'mutation-' + id,
['mutate']
);
mockTimespans[id].getStart.andReturn(index * 1000);
mockTimespans[id].getDuration.andReturn(4000 + index);
mockTimespans[id].getEnd.andReturn(4000 + index + index * 1000);
mockTimespans[id].getStart.and.returnValue(index * 1000);
mockTimespans[id].getDuration.and.returnValue(4000 + index);
mockTimespans[id].getEnd.and.returnValue(4000 + index + index * 1000);
});
mockLoader = jasmine.createSpyObj('objectLoader', ['load']);
@@ -104,7 +104,7 @@ define(
testConfiguration = {};
mockLoader.load.andReturn(asPromise(
mockLoader.load.and.returnValue(asPromise(
subgraph(mockDomainObject, mockDomainObjects)
));
@@ -193,7 +193,7 @@ define(
it("prevents bulk moves past 0", function () {
// Have a start later; new lowest start is b, at 1000
mockTimespans.a.getStart.andReturn(10000);
mockTimespans.a.getStart.and.returnValue(10000);
handler.move('a', -10000);
// Verify that move was stopped at 0, for b, even though
// move was initiated at a