[ACA-3700] - fix suspened date start date (#7020)

* fix suspened date start date

* remove unnecesarry parameters
This commit is contained in:
Silviu Popa
2021-05-14 15:47:35 +03:00
committed by GitHub
parent 11b66338d0
commit 81042f1951
2 changed files with 30 additions and 1 deletions

View File

@@ -15,6 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
import moment from 'moment';
import { DateCloudFilterType } from 'process-services-cloud';
import { ProcessFilterCloudModel } from './process-filter-cloud.model'; import { ProcessFilterCloudModel } from './process-filter-cloud.model';
describe('ProcessFilterCloudModel', () => { describe('ProcessFilterCloudModel', () => {
@@ -35,4 +37,31 @@ describe('ProcessFilterCloudModel', () => {
expect(model.appVersion).toEqual([1, 2]); expect(model.appVersion).toEqual([1, 2]);
}); });
it('should get suspended start and end date if date type is today', () => {
const date = new Date();
const model = new ProcessFilterCloudModel({
suspendedDateType: DateCloudFilterType.TODAY
});
expect(model.suspendedFrom).toEqual(moment(date).startOf('day').toISOString(true));
expect(model.suspendedTo).toEqual(moment(date).endOf('day').toISOString(true));
});
it('should get completed date start and end date if date type is today', () => {
const date = new Date();
const model = new ProcessFilterCloudModel({
completedDateType: DateCloudFilterType.TODAY
});
expect(model.completedFrom).toEqual(moment(date).startOf('day').toISOString(true));
expect(model.completedTo).toEqual(moment(date).endOf('day').toISOString(true));
});
it('should get started date start and end date if date type is today', () => {
const date = new Date();
const model = new ProcessFilterCloudModel({
startedDateType: DateCloudFilterType.TODAY
});
expect(model.startFrom).toEqual(moment(date).startOf('day').toISOString(true));
expect(model.startTo).toEqual(moment(date).endOf('day').toISOString(true));
});
}); });

View File

@@ -150,7 +150,7 @@ export class ProcessFilterCloudModel {
if (this.isDateRangeType(this.suspendedDateType)) { if (this.isDateRangeType(this.suspendedDateType)) {
return this._suspendedFrom; return this._suspendedFrom;
} }
return this.getEndDate(this.suspendedDateType); return this.getStartDate(this.suspendedDateType);
} }
get suspendedTo(): string { get suspendedTo(): string {