2020-02-06 13:59:00 +00:00
|
|
|
import './index';
|
|
|
|
|
|
|
|
describe('Ticket', () => {
|
|
|
|
describe('Component vnTicketRequestIndex', () => {
|
|
|
|
let controller;
|
|
|
|
|
|
|
|
beforeEach(ngModule('ticket'));
|
|
|
|
|
2020-03-18 07:35:59 +00:00
|
|
|
beforeEach(angular.mock.inject($componentController => {
|
|
|
|
const $element = angular.element('<vn-ticket-request-index></vn-ticket-request-index>');
|
|
|
|
controller = $componentController('vnTicketRequestIndex', {$element});
|
2020-02-06 13:59:00 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
describe('getRequestState()', () => {
|
|
|
|
it('should return New when the state is null', () => {
|
|
|
|
let state = null;
|
|
|
|
let result = controller.getRequestState(state);
|
|
|
|
|
|
|
|
expect(result).toEqual('New');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return Denied when the state is false', () => {
|
|
|
|
let state = false;
|
|
|
|
let result = controller.getRequestState(state);
|
|
|
|
|
|
|
|
expect(result).toEqual('Denied');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return Acepted when the state is true', () => {
|
|
|
|
let state = true;
|
|
|
|
let result = controller.getRequestState(state);
|
|
|
|
|
|
|
|
expect(result).toEqual('Acepted');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('isEditable()', () => {
|
|
|
|
it('should return true when isOk is true', () => {
|
|
|
|
let isOk = true;
|
|
|
|
let result = controller.isEditable(isOk);
|
|
|
|
|
|
|
|
expect(result).toEqual(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return true when isOk is false', () => {
|
|
|
|
let isOk = false;
|
|
|
|
let result = controller.isEditable(isOk);
|
|
|
|
|
|
|
|
expect(result).toEqual(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return true when isOk is null', () => {
|
|
|
|
let isOk = null;
|
|
|
|
let result = controller.isEditable(isOk);
|
|
|
|
|
|
|
|
expect(result).toEqual(false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|