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

url.js ➔ describe(ꞌUrlꞌ)   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 15
rs 9.4285
nop 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A url.js ➔ ... ➔ it(ꞌconfiguration fileꞌ) 0 5 2
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