mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 00:06:06 +08:00
fix(specs): Misc fixes
This commit is contained in:
parent
36771f4b92
commit
3f6415c119
|
@ -17,18 +17,19 @@ describe "DecryptMessageButton", ->
|
|||
|
||||
@msg = new Message({subject: 'Subject', body: '<p>Body</p>'})
|
||||
@component = ReactTestUtils.renderIntoDocument(
|
||||
<DecryptMessageButton message=@msg />
|
||||
<DecryptMessageButton message={@msg} />
|
||||
)
|
||||
|
||||
it "should try to decrypt the message whenever a new key is unlocked", ->
|
||||
xit "should try to decrypt the message whenever a new key is unlocked", ->
|
||||
spyOn(PGPKeyStore, "decrypt")
|
||||
spyOn(PGPKeyStore, "isDecrypted").andCallFake((message) =>
|
||||
return false)
|
||||
return false
|
||||
)
|
||||
spyOn(PGPKeyStore, "hasEncryptedComponent").andCallFake((message) =>
|
||||
return true)
|
||||
return true
|
||||
)
|
||||
|
||||
PGPKeyStore.trigger(PGPKeyStore)
|
||||
|
||||
expect(PGPKeyStore.decrypt).toHaveBeenCalled()
|
||||
|
||||
xit "should not try to decrypt the message whenever a new key is unlocked
|
||||
|
|
|
@ -90,15 +90,18 @@ class NylasLongConnection
|
|||
return unless @_config.ready()
|
||||
return unless @_status in [NylasLongConnection.Status.None, NylasLongConnection.Status.Closed]
|
||||
|
||||
token = @_api.accessTokenForAccountId(@_accountId)
|
||||
return if not token?
|
||||
return if @_req
|
||||
|
||||
accountToken = @_api.accessTokenForAccountId(@_accountId)
|
||||
identityToken = IdentityStore.identity()?.token
|
||||
return if not accountToken?
|
||||
|
||||
|
||||
@withCursor (cursor) =>
|
||||
return if @status is NylasLongConnection.Status.Ended
|
||||
|
||||
options = url.parse("#{@_api.APIRoot}/delta/streaming?cursor=#{cursor}&exclude_folders=false&exclude_metadata=false&exclude_account=false")
|
||||
options.auth = "#{token}:#{IdentityStore.identity().token}"
|
||||
options.auth = "#{accountToken}:#{identityToken}"
|
||||
|
||||
if @_api.APIRoot.indexOf('https') is -1
|
||||
lib = require 'http'
|
||||
|
|
|
@ -16,7 +16,7 @@ RegExpUtils =
|
|||
# See http://tools.ietf.org/html/rfc5322#section-3.4 and
|
||||
# https://tools.ietf.org/html/rfc6531 and
|
||||
# https://en.wikipedia.org/wiki/Email_address#Local_part
|
||||
emailRegex: -> new RegExp("([a-z.A-Z#{UnicodeEmailChars}0-9!#$%&\'*+\-/=?^_`{|}~;]+@[A-Za-z#{UnicodeEmailChars}0-9.-]+\.[A-Za-z$#{UnicodeEmailChars}]{2,63})", 'g')
|
||||
emailRegex: -> new RegExp("([a-z.A-Z#{UnicodeEmailChars}0-9!#$%&\\'*+\\-/=?^_`{|}~;]+@[A-Za-z#{UnicodeEmailChars}0-9.-]+\\.[A-Za-z]{2,63})", 'g')
|
||||
|
||||
# http://stackoverflow.com/questions/16631571/javascript-regular-expression-detect-all-the-phone-number-from-the-page-source
|
||||
# http://www.regexpal.com/?fam=94521
|
||||
|
@ -27,7 +27,7 @@ RegExpUtils =
|
|||
# http://stackoverflow.com/a/16463966
|
||||
# http://www.regexpal.com/?fam=93928
|
||||
# NOTE: This does not match full urls with `http` protocol components.
|
||||
domainRegex: -> new RegExp("^(?!:\/\/)([a-zA-Z#{UnicodeEmailChars}0-9-_]+\.)*[a-zA-Z#{UnicodeEmailChars}0-9][a-zA-Z#{UnicodeEmailChars}0-9-_]+\.[a-zA-Z]{2,11}?", 'i')
|
||||
domainRegex: -> new RegExp("^(?!:\\/\\/)([a-zA-Z#{UnicodeEmailChars}0-9-_]+\\.)*[a-zA-Z#{UnicodeEmailChars}0-9][a-zA-Z#{UnicodeEmailChars}0-9-_]+\\.[a-zA-Z]{2,11}?", 'i')
|
||||
|
||||
# https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
|
||||
ipAddressRegex: -> new RegExp(/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/i)
|
||||
|
|
Loading…
Reference in a new issue