2022-04-07 09:41:35 +00:00
|
|
|
import './index';
|
|
|
|
|
|
|
|
describe('client unpaid', () => {
|
|
|
|
describe('Component vnClientUnpaid', () => {
|
|
|
|
let controller;
|
|
|
|
|
|
|
|
beforeEach(ngModule('client'));
|
|
|
|
|
2022-04-07 13:05:10 +00:00
|
|
|
beforeEach(inject($componentController => {
|
2022-04-07 09:41:35 +00:00
|
|
|
const $element = angular.element('<vn-client-unpaid></vn-client-unpaid>');
|
2022-04-07 13:05:10 +00:00
|
|
|
controller = $componentController('vnClientUnpaid', {$element});
|
2022-04-07 09:41:35 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
describe('setDefaultDate()', () => {
|
2022-04-07 13:05:10 +00:00
|
|
|
it(`should not set today date if has dated`, () => {
|
2022-04-07 09:41:35 +00:00
|
|
|
const hasData = true;
|
|
|
|
const yesterday = new Date();
|
|
|
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
|
|
|
|
|
|
controller.clientUnpaid = {
|
|
|
|
dated: yesterday
|
|
|
|
};
|
|
|
|
controller.setDefaultDate(hasData);
|
|
|
|
|
|
|
|
expect(controller.clientUnpaid.dated).toEqual(yesterday);
|
|
|
|
});
|
|
|
|
|
2022-04-07 13:05:10 +00:00
|
|
|
it(`should set today if not has dated`, () => {
|
|
|
|
const hasData = true;
|
2022-04-07 09:41:35 +00:00
|
|
|
|
|
|
|
controller.clientUnpaid = {};
|
|
|
|
controller.setDefaultDate(hasData);
|
|
|
|
|
2022-04-07 13:05:10 +00:00
|
|
|
expect(controller.clientUnpaid.dated).toBeDefined();
|
2022-04-07 09:41:35 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|