diff --git a/spec/models/contact-spec.coffee b/spec/models/contact-spec.coffee index 9b1a39365..5c01f5b3f 100644 --- a/spec/models/contact-spec.coffee +++ b/spec/models/contact-spec.coffee @@ -6,10 +6,11 @@ contact_1 = name: "Evan Morikawa" email: "evan@nylas.com" -account = AccountStore.accounts()[0] - describe "Contact", -> + beforeEach -> + @account = AccountStore.accounts()[0] + it "can be built via the constructor", -> c1 = new Contact contact_1 expect(c1.name).toBe "Evan Morikawa" @@ -128,29 +129,29 @@ describe "Contact", -> expect(c8.lastName()).toBe "K@ylor" it "should properly return `You` as the display name for the current user", -> - c1 = new Contact {name: " Test Monkey", email: account.emailAddress} + c1 = new Contact {name: " Test Monkey", email: @account.emailAddress} expect(c1.displayName()).toBe "You" expect(c1.displayFirstName()).toBe "You" expect(c1.displayLastName()).toBe "" describe "isMe", -> it "returns true if the contact name matches the account email address", -> - c1 = new Contact {email: account.emailAddress} + c1 = new Contact {email: @account.emailAddress} expect(c1.isMe()).toBe(true) c1 = new Contact {email: 'ben@nylas.com'} expect(c1.isMe()).toBe(false) it "is case insensitive", -> - c1 = new Contact {email: account.emailAddress.toUpperCase()} + c1 = new Contact {email: @account.emailAddress.toUpperCase()} expect(c1.isMe()).toBe(true) it "also matches any aliases you've created", -> - jasmine.unspy(AccountStore, 'current') - spyOn(AccountStore, 'current').andCallFake -> + spyOn(AccountStore, 'accounts').andReturn [ new Account provider: "gmail" aliases: ["Ben Other "] emailAddress: 'ben@nylas.com' + ] c1 = new Contact {email: 'ben22@nylas.com'} expect(c1.isMe()).toBe(true) diff --git a/src/flux/models/thread.coffee b/src/flux/models/thread.coffee index 79958b4e7..10273e4d3 100644 --- a/src/flux/models/thread.coffee +++ b/src/flux/models/thread.coffee @@ -120,7 +120,7 @@ class Thread extends Model isUnhiddenStandardLabel = (l) -> not isImportant(l) and \ isStandardCategory(l) and\ - not (l.name.isHiddenCategory()) + not (l.isHiddenCategory()) importantLabel = _.find @labels, isImportant out = out.concat importantLabel if importantLabel