webogram-i2p/test/unit/userNameFilterSpec.js
Bart 03bc92006d Added tests for AppImPanelController, DocumentModalController, EmbedModalController and VideoModalController (#1362)
* Added test for AppImPanelControllerSpec, cleaned up style of all tests

All tests give 0 errors when running gulp standard
All credits for those test still go to @Ryuno-Ki, I did not functionaly change the testing code

* add Test for DocumentModalController

* added tests for the EmbedModalController and VideoModalController
2017-04-03 17:01:53 +03:00

45 lines
998 B
JavaScript

/* global describe, it, inject, expect, beforeEach */
describe('userName filter', function () {
var $filter, _, userNameFilter
beforeEach(module('myApp.filters'))
beforeEach(inject(function (_$filter_, ___) {
$filter = _$filter_
_ = ___
}))
beforeEach(function () {
userNameFilter = $filter('userName')
})
it('displays user name deleted', function () {
var expected = _('user_name_deleted')
var actual = userNameFilter(null)
expect(actual).toEqual(expected)
})
it('displays the first name', function () {
var user = {
first_name: 'John'
}
var expected = user.first_name
var actual = userNameFilter(user)
expect(actual).toEqual(expected)
})
it('displays both, the first and the last name', function () {
var user = {
first_name: 'John',
last_name: 'Doe'
}
var expected = user.first_name + ' ' + user.last_name
var actual = userNameFilter(user)
expect(actual).toEqual(expected)
})
})