import Daterangepicker from 'dasf-web/lib/dateSelection/daterangepicker/Daterangepicker.vue';
import Vue from "vue";
import { shallowMount, createLocalVue } from '@vue/test-utils';


const localVue = createLocalVue();
describe("Daterangepicker.vue test",() => {

    let wrapper, vm;
        
    beforeEach(() => {
        wrapper = shallowMount(Daterangepicker as any, {
            localVue,
            propsData: {},
        });
        vm = wrapper.mount;
        let cmp = Vue.extend(Daterangepicker);
        vm = new cmp({
            data: {
            }
        }).$mount();
    });


    test('render Text Date Style',()=>{
        //given
        let mindate: Date = new Date("2000-01-01");
        let renderedText: string = vm.renderTextDateStyle(mindate);
        
        console.log("renderedText: "+new Date(renderedText));

        expect(mindate.getDay()).toBe(new Date(renderedText).getDay());
        expect(mindate.getMonth()).toBe(new Date(renderedText).getMonth());
        expect(mindate.getFullYear()).toBe(new Date(renderedText).getFullYear());
    });

})

function addDaysToDate(oldDate: Date, day: number): Date{
    return new Date(oldDate.getTime()+(60*1000*60*24*day))
 }