Debian Codegraph @

test/instrumentation/test-es6-arrow-fn.js

raw symbols SCIP
1 /*jslint nomen: true */
2 var helper = require('../helper'),
3 code,
4 verifier;
5
6 /*jshint maxlen: 500 */
7 if (require('../es6').isArrowFnAvailable()) {
8 module.exports = {
9 "with an expression arrow expression": {
10 setUp: function (cb) {
11 code = [
12 'var input = args',
13 'output = input.map(x => x * x)'
14 ];
15 verifier = helper.verifier(__filename, code);
16 cb();
17 },
18
19 "should cover it correctly": function (test) {
20 verifier.verify(test, [1, 2, 3, 4], [1, 4, 9, 16], { lines: { '1': 1, '2': 4 }, branches: {}, functions: {}, statements: { '1': 1, '2': 1, '3': 4} });
21 test.done();
22 },
23
24 "should report no calls correctly": function (test) {
25 verifier.verify(test, [], [], { lines: { '1': 1, '2': 1 }, branches: {}, functions: {}, statements: { '1': 1, '2': 1, '3': 0} });
26 test.done();
27 }
28 },
29 "with a block arrow expression": {
30 setUp: function (cb) {
31 code = [
32 'var input = args',
33 'output = input.map(x => { return x * x; })'
34 ];
35 verifier = helper.verifier(__filename, code);
36 cb();
37 },
38
39 "should cover it correctly": function (test) {
40 verifier.verify(test, [1, 2, 3, 4], [1, 4, 9, 16], { lines: { '1': 1, '2': 4 }, branches: {}, functions: {}, statements: { '1': 1, '2': 1, '3': 4} });
41 test.done();
42 },
43
44 "should report no calls correctly": function (test) {
45 verifier.verify(test, [], [], { lines: { '1': 1, '2': 1 }, branches: {}, functions: {}, statements: { '1': 1, '2': 1, '3': 0} });
46 test.done();
47 }
48 }
49 };
50 }
51