vendredi 4 septembre 2020

How to test FullCalendar function which was rewritten with mixin

I use FullCalendar v2.2.7 and I need to test modified method (computeRange), to which I get access via mixin. Testing should be via Jasmine/Karma. Tools: AngularJS, TS.

How can I intercept a function computeRange and mock mixin? Here is code where I rewrite the function:

export default class CustomFullCalendarService {
    constructor() {
        'ngInject';
    }

    public rewriteFullCalendarMethods(fullCalendar) {
        let range;

        fullCalendar.views.month.mixin({
            computeRange() {

                // My own code rewriting computeRange() logic

                return range;
            }
        });
    };
};

Aucun commentaire:

Enregistrer un commentaire