Updating tests

This commit is contained in:
Henry 2015-11-03 11:00:30 -08:00 committed by Andrew Henry
parent 2f90a89065
commit 5cd458a733

View File

@ -243,7 +243,7 @@ define(
beforeEach(function () { beforeEach(function () {
mockQ = jasmine.createSpyObj('mockQ', ['when', 'all', 'reject']); mockQ = jasmine.createSpyObj('mockQ', ['when', 'all', 'reject']);
//mockQ.when.andCallFake(synchronousPromise); mockQ.when.andCallFake(synchronousPromise);
mockQ.all.andCallFake(function (promises) { mockQ.all.andCallFake(function (promises) {
var result = {}; var result = {};
Object.keys(promises).forEach(function (k) { Object.keys(promises).forEach(function (k) {
@ -272,7 +272,7 @@ define(
compositionCapability compositionCapability
.invoke .invoke
.andReturn(compositionPromise); .andReturn(synchronousPromise([childObject]));
object = domainObjectFactory({ object = domainObjectFactory({
name: 'object', name: 'object',
@ -306,10 +306,10 @@ define(
createObjectPromise = synchronousPromise(newObject); createObjectPromise = synchronousPromise(newObject);
creationService.createObject.andReturn(createObjectPromise); creationService.createObject.andReturn(createObjectPromise);
copyService = new CopyService(mockQ, creationService, policyService); copyService = new CopyService(mockQ, creationService, policyService, mockPersistenceService);
console.log("Before perform"); console.log("Before perform");
compositionPromise.then.andReturn(synchronousPromise([childObject])); //compositionPromise.then.andReturn(synchronousPromise([childObject]));
mockQ.when.andReturn(compositionPromise); //mockQ.when.andReturn(compositionPromise);
copyResult = copyService.perform(object, newParent); copyResult = copyService.perform(object, newParent);
console.log("After perform"); console.log("After perform");
//compositionPromise.then.mostRecentCall.args[0]([childObject]); //compositionPromise.then.mostRecentCall.args[0]([childObject]);
@ -330,8 +330,9 @@ define(
});*/ });*/
it("uses persistence service", function () { it("uses persistence service", function () {
//Need a better way of testing duplication here.
expect(mockPersistenceService.createObject) expect(mockPersistenceService.createObject)
.toHaveBeenCalledWith(persistenceCapability, jasmine.any(String), newParent); .toHaveBeenCalledWith(persistenceCapability, jasmine.any(String), jasmine.any(Object));
expect(createObjectPromise.then) expect(createObjectPromise.then)
.toHaveBeenCalledWith(jasmine.any(Function)); .toHaveBeenCalledWith(jasmine.any(Function));