2016-05-04 07:42:28 +08:00
|
|
|
Task = require('../../src/flux/tasks/task').default
|
|
|
|
Thread = require('../../src/flux/models/thread').default
|
|
|
|
ChangeUnreadTask = require('../../src/flux/tasks/change-unread-task').default
|
2015-08-06 06:53:08 +08:00
|
|
|
|
|
|
|
describe 'ChangeUnreadTask', ->
|
|
|
|
describe "description", ->
|
|
|
|
it 'should include special cases for changing unread', ->
|
|
|
|
threads = [
|
|
|
|
new Thread(id:"id-1")
|
|
|
|
new Thread(id:"id-2")
|
|
|
|
new Thread(id:"id-3")
|
|
|
|
]
|
|
|
|
task = new ChangeUnreadTask({threads, unread: true})
|
|
|
|
expect(task.description()).toEqual("Marked 3 threads as unread")
|
|
|
|
task = new ChangeUnreadTask({thread: threads[0], unread: true})
|
|
|
|
expect(task.description()).toEqual("Marked as unread")
|
|
|
|
task = new ChangeUnreadTask({threads, unread: false})
|
|
|
|
expect(task.description()).toEqual("Marked 3 threads as read")
|
|
|
|
task = new ChangeUnreadTask({thread: threads[0], unread: false})
|
|
|
|
expect(task.description()).toEqual("Marked as read")
|