test/url.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 1.5

Size

Lines of Code 23
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
wmc 3
nc 1
mnd 1
bc 3
fnc 2
dl 0
loc 23
rs 10
bpm 1.5
cpm 1.5
noi 1
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A url.js ➔ describe(ꞌUrlꞌ) 0 15 1
1
var chai = require('chai');
2
var path = require('path');
3
4
var coreUtils = require('../src/cli').coreUtils
5
var fse = require('fs-extra')
6
var config = require('../src/cli').config
7
config.set({root: path.join(__dirname,'fixtures')})
8
9
describe('Url', function() {
10
11
  var urls = fse.readJsonSync(path.join(__dirname, 'fixtures', 'string', 'urls.json'), 'utf8')
12
13
  /**
14
   * getAbeImport
15
   * 
16
   */
17
  it('configuration file', function() {
18
    for(var key in urls){
0 ignored issues
show
Complexity introduced by
A for in loop automatically includes the property of any prototype object, consider checking the key using hasOwnProperty.

When iterating over the keys of an object, this includes not only the keys of the object, but also keys contained in the prototype of that object. It is generally a best practice to check for these keys specifically:

var someObject;
for (var key in someObject) {
    if ( ! someObject.hasOwnProperty(key)) {
        continue; // Skip keys from the prototype.
    }

    doSomethingWith(key);
}
Loading history...
19
      chai.assert.equal(coreUtils.slug.clean(key), urls[key] + config.files.templates.extension, key + 'slugified url did not match')
20
    }
21
  });
22
23
});
24