web/satellite/tests/unit/common: Fix hardcoded year check

Don't use a hardcoded year number for tests which depends on the current
year for avoiding that they don't pass when a new year starts.

Change-Id: I52b6248f6c3ddd2df89a4b04caf3a228b0d564e0
This commit is contained in:
Ivan Fraixedes 2020-01-02 12:08:36 +01:00 committed by Matt Robinson
parent 3e873158f4
commit 105a9a4848

View File

@ -117,13 +117,15 @@ describe('VDatePicker.vue', () => {
wrapper.find('.year-selection').trigger('click');
expect(wrapper.findAll('.year').length).toBe(100);
expect(wrapper.findAll('.year').at(0).text()).toBe('2019');
const currentYear = (new Date()).getFullYear()
expect(wrapper.findAll('.year').at(0).text()).toBe(currentYear.toString());
wrapper.find('.year-selection').trigger('click');
wrapper.findAll('.year').at(1).trigger('click');
expect(wrapper.vm.selectedDateState.year).toBe(2018);
expect(wrapper.find('.year-selection').text()).toBe('2018');
expect(wrapper.vm.selectedDateState.year).toBe(currentYear-1);
expect(wrapper.find('.year-selection').text()).toBe((currentYear-1).toString());
});
it('triggers correct functionality on month incrementation', function () {