[ACS-5857] modified unit tests

This commit is contained in:
SheenaMalhotra182
2023-09-20 15:47:19 +05:30
parent 4b9a625e26
commit d94be47ec3
4 changed files with 13 additions and 13 deletions
@@ -392,7 +392,7 @@ describe('DateWidgetComponent', () => {
describe('check date validation by dynamic date ranges', () => {
it('should minValue be equal to today date minus minDateRangeValue', async () => {
spyOn(widget, 'getTodaysFormattedDate').and.returnValue(new Date('2022-07-22'));
spyOn(widget, 'getTodaysDate').and.returnValue(new Date('2022-07-22'));
widget.field = new FormFieldModel(null, {
dynamicDateRangeSelection: true,
maxDateRangeValue: null,
@@ -412,7 +412,7 @@ describe('DateWidgetComponent', () => {
});
it('should maxValue be equal to today date plus maxDateRangeValue', async () => {
spyOn(widget, 'getTodaysFormattedDate').and.returnValue(new Date('2022-07-22'));
spyOn(widget, 'getTodaysDate').and.returnValue(new Date('2022-07-22'));
widget.field = new FormFieldModel(null, {
dynamicDateRangeSelection: true,
maxDateRangeValue: 8,
@@ -432,7 +432,7 @@ describe('DateWidgetComponent', () => {
});
it('should maxValue and minValue be null if maxDateRangeValue and minDateRangeValue are null', async () => {
spyOn(widget, 'getTodaysFormattedDate').and.returnValue(new Date('22-07-2022'));
spyOn(widget, 'getTodaysDate').and.returnValue(new Date('22-07-2022'));
widget.field = new FormFieldModel(null, {
dynamicDateRangeSelection: true,
maxDateRangeValue: null,
@@ -451,7 +451,7 @@ describe('DateWidgetComponent', () => {
});
it('should maxValue and minValue not be null if maxDateRangeVale and minDateRangeValue are not null', async () => {
spyOn(widget, 'getTodaysFormattedDate').and.returnValue(new Date('2022-07-22'));
spyOn(widget, 'getTodaysDate').and.returnValue(new Date('2022-07-22'));
widget.field = new FormFieldModel(null, {
dynamicDateRangeSelection: true,
maxDateRangeValue: 8,
@@ -71,7 +71,7 @@ export class DateCloudWidgetComponent extends WidgetComponent implements OnInit,
if (this.field) {
if (this.field.dynamicDateRangeSelection) {
const today = this.getTodaysFormattedDate();
const today = this.getTodaysDate();
if (Number.isInteger(this.field.minDateRangeValue)) {
this.minDate = format(subDays(today, this.field.minDateRangeValue), DATE_FORMAT_CLOUD);
this.field.minValue = this.minDate;
@@ -93,7 +93,7 @@ export class DateCloudWidgetComponent extends WidgetComponent implements OnInit,
}
}
getTodaysFormattedDate() {
getTodaysDate() {
return new Date();
}