diaspora/spec/javascripts/app/collections/aspect_memberships_spec.js
cmrd Senya 923fb8a763
Refactor app.views.AspectMembership
in order to support adding new aspect to a dropdown without full
page reload
2016-08-08 17:21:14 +03:00

17 lines
684 B
JavaScript

describe("app.collections.AspectMemberships", function() {
beforeEach(function() {
this.models = [factory.aspectMembershipAttrs(), factory.aspectMembershipAttrs(), factory.aspectMembershipAttrs()];
this.collection = new app.collections.AspectMemberships(this.models);
});
describe("#findByAspectId", function() {
it("finds a model in collection", function() {
var model = this.collection.findByAspectId(this.models[1].aspect.id);
expect(model.get("id")).toEqual(this.models[1].id);
});
it("returns undefined when nothing found", function() {
expect(this.collection.findByAspectId(factory.id.next())).toEqual(undefined);
});
});
});