So I am a newbie in javascript and i had been going through some one else's code and I found this..
describe('deviceready', function() { it('should report that it fired', function() { spyOn(app, 'report'); app.deviceready(); expect(app.report).toHaveBeenCalledWith('deviceready'); }); });
What I don't understand is: What exactly does the describe
keyword do?
info:
- Its a phonegap application
- We are using the spine.js and jQuery libraries
describe() allows you to gather your tests into separate groupings within the same file, even multiple nested levels. Now, nesting is one of the most-maligned features of RSpec, because it's easy to take it too far.
Each describe block specifies a larger component or function and contains a set of specifications. A specification is defined by an it block. Each it block functions as a test and is evaluated in its own environment. You can also have nested describe blocks.
Jasmine is a testing framework for JavaScript. Suite is the basic building block of Jasmine framework. The collection of similar type test cases written for a specific file or function is known as one suite. It contains two other blocks, one is “Describe()” and another one is “It()”.
describe() is simply a way to group our tests in Mocha. We can nest our tests in groups as deep as we deem necessary. describe() takes two arguments, the first is the name of the test group, and the second is a callback function.
Describe is a function in the Jasmine testing framework. It simply describes the suite of test cases enumerated by the "it" functions.
Also used in the mochajs framework.
Describe
is not part of Javascript, it is a function defined in the library you used (namely Jasmine)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With