diaspora/spec/javascripts/app/models/contact_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

27 lines
901 B
JavaScript

describe("app.models.Contact", function() {
beforeEach(function(){
this.aspect = factory.aspect();
this.contact = new app.models.Contact({
person: { name: "aaa" },
aspect_memberships: [{id: 42, aspect: this.aspect}]
});
});
describe("initialize", function() {
it("sets person object with contact reference", function() {
expect(this.contact.person.get("name")).toEqual("aaa");
expect(this.contact.person.contact).toEqual(this.contact);
});
});
describe("inAspect", function(){
it("returns true if the contact has been added to the aspect", function(){
expect(this.contact.inAspect(this.aspect.id)).toBeTruthy();
});
it("returns false if the contact hasn't been added to the aspect", function(){
expect(this.contact.inAspect(this.aspect.id+1)).toBeFalsy();
});
});
});