[Code Style] Run gulp fixstyle
...to apply code style settings from #142.
This commit is contained in:
@@ -64,7 +64,7 @@ define(
|
||||
|
||||
mockObjectService = jasmine.createSpyObj(
|
||||
"objectService",
|
||||
[ "getObjects" ]
|
||||
["getObjects"]
|
||||
);
|
||||
|
||||
mockInjector = {
|
||||
@@ -97,7 +97,7 @@ define(
|
||||
});
|
||||
|
||||
it("requests ids found in model's composition from the object service", function () {
|
||||
var ids = [ "a", "b", "c", "xyz" ];
|
||||
var ids = ["a", "b", "c", "xyz"];
|
||||
|
||||
mockDomainObject.getModel.andReturn({ composition: ids });
|
||||
|
||||
@@ -114,7 +114,9 @@ define(
|
||||
mockObjectService.getObjects.andReturn(mockPromise({x: mockChild}));
|
||||
mockChild.getCapability.andReturn(undefined);
|
||||
|
||||
composition.invoke().then(function (c) { result = c; });
|
||||
composition.invoke().then(function (c) {
|
||||
result = c;
|
||||
});
|
||||
|
||||
// Should have been added by a wrapper
|
||||
expect(result[0].getCapability('context')).toBeDefined();
|
||||
@@ -153,7 +155,7 @@ define(
|
||||
|
||||
it("does not re-add IDs which are already present", function () {
|
||||
var result,
|
||||
testModel = { composition: [ 'a' ] },
|
||||
testModel = { composition: ['a'] },
|
||||
mockChild = jasmine.createSpyObj("child", DOMAIN_OBJECT_METHODS);
|
||||
|
||||
mockDomainObject.getModel.andReturn(testModel);
|
||||
@@ -184,7 +186,7 @@ define(
|
||||
|
||||
it("can add objects at a specified index", function () {
|
||||
var result,
|
||||
testModel = { composition: [ 'a', 'b', 'c' ] },
|
||||
testModel = { composition: ['a', 'b', 'c'] },
|
||||
mockChild = jasmine.createSpyObj("child", DOMAIN_OBJECT_METHODS);
|
||||
|
||||
mockDomainObject.getModel.andReturn(testModel);
|
||||
|
||||
@@ -46,7 +46,7 @@ define(
|
||||
mockDomainObject = jasmine.createSpyObj("domainObject", DOMAIN_OBJECT_METHODS);
|
||||
mockParent = jasmine.createSpyObj("parent", DOMAIN_OBJECT_METHODS);
|
||||
mockGrandparent = jasmine.createSpyObj("grandparent", DOMAIN_OBJECT_METHODS);
|
||||
mockContext = jasmine.createSpyObj("context", [ "getParent", "getRoot", "getPath" ]);
|
||||
mockContext = jasmine.createSpyObj("context", ["getParent", "getRoot", "getPath"]);
|
||||
|
||||
mockParent.getCapability.andReturn(mockContext);
|
||||
mockContext.getParent.andReturn(mockGrandparent);
|
||||
@@ -77,4 +77,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -79,4 +79,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -31,16 +31,22 @@ define(
|
||||
var mockLog,
|
||||
provider;
|
||||
|
||||
function BasicCapability() { return; }
|
||||
function BasicCapability() {
|
||||
return;
|
||||
}
|
||||
BasicCapability.key = "basic";
|
||||
|
||||
function ApplicableCapability() { return; }
|
||||
function ApplicableCapability() {
|
||||
return;
|
||||
}
|
||||
ApplicableCapability.key = "applicable";
|
||||
ApplicableCapability.appliesTo = function (model) {
|
||||
return !model.isNotApplicable;
|
||||
};
|
||||
|
||||
function KeylessCapability() { return; }
|
||||
function KeylessCapability() {
|
||||
return;
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockLog = jasmine.createSpyObj(
|
||||
|
||||
@@ -36,7 +36,11 @@ define(
|
||||
object = {},
|
||||
delegation;
|
||||
|
||||
function capture(k) { return function (v) { captured[k] = v; }; }
|
||||
function capture(k) {
|
||||
return function (v) {
|
||||
captured[k] = v;
|
||||
};
|
||||
}
|
||||
function TestDomainObject(caps, id) {
|
||||
return {
|
||||
getId: function () {
|
||||
@@ -67,12 +71,16 @@ define(
|
||||
beforeEach(function () {
|
||||
captured = {};
|
||||
typeDef = {};
|
||||
typeDef.delegates = [ "foo" ];
|
||||
type = { getDefinition: function () { return typeDef; } };
|
||||
typeDef.delegates = ["foo"];
|
||||
type = { getDefinition: function () {
|
||||
return typeDef;
|
||||
} };
|
||||
children = [];
|
||||
capabilities = {
|
||||
type: type,
|
||||
composition: { invoke: function () { return mockPromise(children); } }
|
||||
composition: { invoke: function () {
|
||||
return mockPromise(children);
|
||||
} }
|
||||
};
|
||||
object = new TestDomainObject(capabilities);
|
||||
|
||||
@@ -95,4 +103,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -38,15 +38,15 @@ define(
|
||||
mockInstantiate = jasmine.createSpy("instantiate");
|
||||
mockIdentifierService = jasmine.createSpyObj(
|
||||
'identifierService',
|
||||
[ 'parse', 'generate' ]
|
||||
['parse', 'generate']
|
||||
);
|
||||
mockIdentifier = jasmine.createSpyObj(
|
||||
'identifier',
|
||||
[ 'getSpace', 'getKey', 'getDefinedSpace' ]
|
||||
['getSpace', 'getKey', 'getDefinedSpace']
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getCapability', 'getModel' ]
|
||||
['getId', 'getCapability', 'getModel']
|
||||
);
|
||||
|
||||
mockInjector.get.andCallFake(function (key) {
|
||||
|
||||
@@ -35,8 +35,12 @@ define(
|
||||
topic,
|
||||
mockNow,
|
||||
domainObject = {
|
||||
getId: function () { return "test-id"; },
|
||||
getModel: function () { return testModel; }
|
||||
getId: function () {
|
||||
return "test-id";
|
||||
},
|
||||
getModel: function () {
|
||||
return testModel;
|
||||
}
|
||||
},
|
||||
mutation;
|
||||
|
||||
|
||||
@@ -46,10 +46,10 @@ define(
|
||||
then: function (callback) {
|
||||
return asPromise(callback(value));
|
||||
},
|
||||
catch: function(callback) {
|
||||
catch: function (callback) {
|
||||
//Define a default 'happy' catch, that skips over the
|
||||
// catch callback
|
||||
return doCatch ? asPromise(callback(value)): asPromise(value);
|
||||
return doCatch ? asPromise(callback(value)) : asPromise(value);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -60,16 +60,16 @@ define(
|
||||
|
||||
mockPersistenceService = jasmine.createSpyObj(
|
||||
"persistenceService",
|
||||
[ "updateObject", "readObject", "createObject", "deleteObject" ]
|
||||
["updateObject", "readObject", "createObject", "deleteObject"]
|
||||
);
|
||||
|
||||
mockIdentifierService = jasmine.createSpyObj(
|
||||
'identifierService',
|
||||
[ 'parse', 'generate' ]
|
||||
['parse', 'generate']
|
||||
);
|
||||
mockIdentifier = jasmine.createSpyObj(
|
||||
'identifier',
|
||||
[ 'getSpace', 'getKey', 'getDefinedSpace' ]
|
||||
['getSpace', 'getKey', 'getDefinedSpace']
|
||||
);
|
||||
mockQ = jasmine.createSpyObj(
|
||||
"$q",
|
||||
@@ -81,12 +81,16 @@ define(
|
||||
);
|
||||
mockCacheService = jasmine.createSpyObj(
|
||||
"cacheService",
|
||||
[ "get", "put", "remove", "all" ]
|
||||
["get", "put", "remove", "all"]
|
||||
);
|
||||
|
||||
mockDomainObject = {
|
||||
getId: function () { return id; },
|
||||
getModel: function () { return model; },
|
||||
getId: function () {
|
||||
return id;
|
||||
},
|
||||
getModel: function () {
|
||||
return model;
|
||||
},
|
||||
useCapability: jasmine.createSpy()
|
||||
};
|
||||
// Simulate mutation capability
|
||||
@@ -107,7 +111,7 @@ define(
|
||||
);
|
||||
});
|
||||
|
||||
describe("successful persistence", function() {
|
||||
describe("successful persistence", function () {
|
||||
beforeEach(function () {
|
||||
mockPersistenceService.updateObject.andReturn(happyPromise);
|
||||
mockPersistenceService.createObject.andReturn(happyPromise);
|
||||
@@ -163,9 +167,9 @@ define(
|
||||
});
|
||||
});
|
||||
|
||||
describe("unsuccessful persistence", function() {
|
||||
describe("unsuccessful persistence", function () {
|
||||
var sadPromise = {
|
||||
then: function(callback){
|
||||
then: function (callback) {
|
||||
return asPromise(callback(0), true);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ define(
|
||||
|
||||
mockObjectService = jasmine.createSpyObj(
|
||||
"objectService",
|
||||
[ "getObjects" ]
|
||||
["getObjects"]
|
||||
);
|
||||
|
||||
mockInjector = {
|
||||
@@ -85,7 +85,7 @@ define(
|
||||
});
|
||||
|
||||
it("requests ids found in model's composition from the object service", function () {
|
||||
var ids = [ "a", "b", "c", "xyz" ];
|
||||
var ids = ["a", "b", "c", "xyz"];
|
||||
|
||||
mockDomainObject.getModel.andReturn({ relationships: { xyz: ids } });
|
||||
|
||||
@@ -96,7 +96,7 @@ define(
|
||||
|
||||
it("provides a list of relationship types", function () {
|
||||
mockDomainObject.getModel.andReturn({ relationships: {
|
||||
abc: [ 'a', 'b' ],
|
||||
abc: ['a', 'b'],
|
||||
def: "not an array, should be ignored",
|
||||
xyz: []
|
||||
} });
|
||||
@@ -139,4 +139,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user