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:
committed by
Pete Richards
parent
013eba744d
commit
433dee0314
@@ -39,7 +39,7 @@ define(
|
||||
'policyService',
|
||||
['allow']
|
||||
);
|
||||
mockPolicyService.allow.andReturn(true);
|
||||
mockPolicyService.allow.and.returnValue(true);
|
||||
linkService = new LinkService(mockPolicyService);
|
||||
});
|
||||
|
||||
@@ -92,7 +92,7 @@ define(
|
||||
});
|
||||
object.id = 'abc';
|
||||
parentCandidate.id = 'xyz';
|
||||
parentCandidate.hasCapability.andCallFake(function (c) {
|
||||
parentCandidate.hasCapability.and.callFake(function (c) {
|
||||
return c !== 'composition';
|
||||
});
|
||||
expect(validate()).toBe(false);
|
||||
@@ -119,13 +119,13 @@ define(
|
||||
});
|
||||
|
||||
it("and returns false", function () {
|
||||
mockPolicyService.allow.andReturn(true);
|
||||
mockPolicyService.allow.and.returnValue(true);
|
||||
expect(validate()).toBe(true);
|
||||
expect(mockPolicyService.allow).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("and returns true", function () {
|
||||
mockPolicyService.allow.andReturn(false);
|
||||
mockPolicyService.allow.and.returnValue(false);
|
||||
expect(validate()).toBe(false);
|
||||
expect(mockPolicyService.allow).toHaveBeenCalled();
|
||||
});
|
||||
@@ -149,8 +149,8 @@ define(
|
||||
'compositionCapability',
|
||||
['invoke', 'add']
|
||||
);
|
||||
compositionCapability.invoke.andReturn(compositionPromise);
|
||||
compositionCapability.add.andReturn(addPromise);
|
||||
compositionCapability.invoke.and.returnValue(compositionPromise);
|
||||
compositionCapability.add.and.returnValue(addPromise);
|
||||
parentModel = {
|
||||
composition: []
|
||||
};
|
||||
@@ -205,9 +205,9 @@ define(
|
||||
}
|
||||
|
||||
spyOn(linkService, 'validate');
|
||||
linkService.validate.andReturn(true);
|
||||
linkService.validate.and.returnValue(true);
|
||||
expect(perform).not.toThrow();
|
||||
linkService.validate.andReturn(false);
|
||||
linkService.validate.and.returnValue(false);
|
||||
expect(perform).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user