Sha256: 8c5c8fff2a2903ce5151134f97a534076861c6e3078078514b0713f552d1ea06

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

describe "App.Wire", ->
  beforeEach ->
    @wire = new App.Wire {}

  afterEach ->
    @wire.disconnect()

  it "sets token correctly", ->
    @wire.setToken "123qweasdzxc"
    expect(@wire._requestParams()).toEqual {synced_at: null, token: "123qweasdzxc"}

  describe '#setPollingTime', ->
    it "can change polling time", ->
      expect(@wire.getPollingTime()).toEqual 3000
      pollingInterval = @wire.getPollingInterval()
      @wire.setPollingTime 10000
      expect(@wire.getPollingTime()).toEqual 10000
      expect(@wire.getPollingInterval()).not.toEqual pollingInterval

  describe "#processNotification", ->
    it "returns if imap is empty", ->
      result = @wire.processNotification ["Article", 1, "created", {id: 1}]
      expect(result).toBe undefined

  describe "#_getURL", ->
    it "returns url with choosen protocol", ->
      @wire.setSSL true
      [protocol] = @wire._getURL().split '/'
      expect(protocol).toEqual 'https:'

    it "return correct notifications's location", ->
      @wire.setLocation 'nc'
      [_, _, _, location] = @wire._getURL().split '/'
      expect(location).toEqual 'nc'

  describe "#setSize", ->
    it "can set max size of notifications", ->
      @wire.setSize 10
      expect(@wire.getSize()).toEqual 10

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
loco-rails-3.0.3 test/dummy/node_modules/loco-js/spec_coffee/loco/base/wire_spec.coffee
loco-rails-3.0.2 test/dummy/node_modules/loco-js/spec_coffee/loco/base/wire_spec.coffee
loco-rails-3.0.1 test/dummy/node_modules/loco-js/spec_coffee/loco/base/wire_spec.coffee
loco-rails-3.0.0 test/dummy/node_modules/loco-js/spec_coffee/loco/base/wire_spec.coffee