salix/modules/account/front/main/index.spec.js

29 lines
795 B
JavaScript

import './index';
describe('component vnUser', () => {
let controller;
beforeEach(ngModule('account'));
beforeEach(inject($componentController => {
controller = $componentController('vnUser', {$element: null});
}));
describe('exprBuilder()', () => {
it('should search by id when only digits string is passed', () => {
let expr = controller.exprBuilder('search', '1');
expect(expr).toEqual({id: '1'});
});
it('should search by name when non-only digits string is passed', () => {
let expr = controller.exprBuilder('search', '1foo');
expect(expr).toEqual({or: [
{name: {like: '%1foo%'}},
{nickname: {like: '%1foo%'}}
]});
});
});
});