2017-04-03 14:01:53 +00:00
|
|
|
/* global describe, it, inject, expect, beforeEach */
|
|
|
|
|
2017-01-12 15:09:31 +00:00
|
|
|
describe('chatTitle filter', function () {
|
2017-04-03 14:01:53 +00:00
|
|
|
var $filter, _, chatTitleFilter
|
2017-01-12 15:09:31 +00:00
|
|
|
|
2017-04-03 14:01:53 +00:00
|
|
|
beforeEach(module('myApp.filters'))
|
2017-01-12 15:09:31 +00:00
|
|
|
|
|
|
|
beforeEach(inject(function (_$filter_, ___) {
|
2017-04-03 14:01:53 +00:00
|
|
|
$filter = _$filter_
|
|
|
|
_ = ___
|
|
|
|
}))
|
2017-01-12 15:09:31 +00:00
|
|
|
|
|
|
|
beforeEach(function () {
|
2017-04-03 14:01:53 +00:00
|
|
|
chatTitleFilter = $filter('chatTitle')
|
|
|
|
})
|
2017-01-12 15:09:31 +00:00
|
|
|
|
|
|
|
it('displays chat title deleted', function () {
|
2017-04-03 14:01:53 +00:00
|
|
|
var expected = _('chat_title_deleted')
|
|
|
|
var actual = chatTitleFilter(null)
|
2017-01-12 15:09:31 +00:00
|
|
|
|
2017-04-03 14:01:53 +00:00
|
|
|
expect(actual).toEqual(expected)
|
|
|
|
})
|
2017-01-12 15:09:31 +00:00
|
|
|
|
|
|
|
it('displays the chat title', function () {
|
|
|
|
var chat = {
|
|
|
|
title: 'Telegraph is hot!'
|
2017-04-03 14:01:53 +00:00
|
|
|
}
|
|
|
|
var expected = chat.title
|
|
|
|
var actual = chatTitleFilter(chat)
|
2017-01-12 15:09:31 +00:00
|
|
|
|
2017-04-03 14:01:53 +00:00
|
|
|
expect(actual).toEqual(expected)
|
|
|
|
})
|
|
|
|
})
|