0

I have a following javascript expression for which i need to cover JS Unit.

var optionValue;

optionValue = function () {
   if(a == false) {
      b.remove();
 }
  a = true;
}

which is getting called in the file constructor as :

  'filepath/': function(setting) {
   optionValue();
}

I am a beginner in Jasmine tests, if anyone can give an idea on how can i cover this scenario. So far i have tried something like below:

 describe('first test', function () {
            var optionValue;
            beforeEach(function() {
                optionValue = jasmine.createSpy('optionvalue');

                optionValue();
            });
            it('should work', function () {
                expect(optionValue).toHaveBeenCalled();
            });
        });
LaviJ
  • 3
  • 1
  • 4

0 Answers0