Completed
Push — master ( 08a083...891dab )
by
unknown
01:56
created

test/url.js   A

Complexity

Total Complexity 3
Complexity/F 1.5

Size

Lines of Code 22
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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

1 Function

Rating   Name   Duplication   Size   Complexity  
A url.js ➔ describe(ꞌUrlꞌ) 0 15 1
1
var chai = require('chai');
2
3
var cleanSlug = require('../src/cli').cleanSlug
4
var fse = require('fs-extra')
5
var config = require('../src/cli').config
6
config.set({root: __dirname + '/fixtures'})
0 ignored issues
show
Compatibility introduced by
Consider using the path module for constructing paths since they are otherwise not cross-OS compatible.
Loading history...
7
8
describe('Url', function() {
9
10
  var urls = fse.readJsonSync(__dirname + '/fixtures/string/urls.json', 'utf8')
0 ignored issues
show
Compatibility introduced by
Consider using the path module for constructing paths since they are otherwise not cross-OS compatible.
Loading history...
11
12
  /**
13
   * getAbeImport
14
   * 
15
   */
16
  it('configuration file', function() {
17
    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...
18
      chai.assert.equal(cleanSlug(key), urls[key] + config.files.templates.extension, key + 'slugified url did not match')
19
    }
20
  });
21
22
});
23