mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-12-21 04:52:47 -05:00
18 lines
661 B
CoffeeScript
18 lines
661 B
CoffeeScript
LadderTabView = require 'views/ladder/LadderTabView'
|
|
Level = require 'models/Level'
|
|
factories = require 'test/app/factories'
|
|
|
|
describe 'LeaderboardData', ->
|
|
it 'triggers "sync" when its request is finished', ->
|
|
level = factories.makeLevel()
|
|
leaderboard = new LadderTabView.LeaderboardData(level, 'humans', null, 4)
|
|
leaderboard.fetch()
|
|
|
|
# no session passed in, so only one request
|
|
expect(jasmine.Ajax.requests.count()).toBe(1)
|
|
|
|
request = jasmine.Ajax.requests.mostRecent()
|
|
triggered = false
|
|
leaderboard.once 'sync', -> triggered = true
|
|
request.respondWith({status: 200, responseText: '{}'})
|
|
expect(triggered).toBe(true)
|