]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/read-installed/test/depth-0.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / read-installed / test / depth-0.js
1 var readInstalled = require("../read-installed.js")
2 var test = require("tap").test
3 var json = require("../package.json")
4 var path = require("path")
5 var known = [].concat(Object.keys(json.dependencies)
6   , Object.keys(json.optionalDependencies)
7   , Object.keys(json.devDependencies)).sort()
8
9 test("make sure that it works with depth=0", function (t) {
10   readInstalled(path.join(__dirname, "../"), {
11     depth: 0
12   }, function (er, map) {
13     t.notOk(er, "er should be bull")
14     t.ok(map, "map should be data")
15     if (er) return console.error(er.stack || er.message)
16     // Exclude self from dependencies when depth = 0
17     delete map.dependencies[json.name]
18     var subdeps = Object.keys(map.dependencies).reduce(function(acc, dep) {
19       // Exclude self from dependencies when depth = current depth
20       delete map.dependencies[dep].dependencies[dep]
21       acc += Object.keys(map.dependencies[dep].dependencies).length;
22       return acc;
23     }, 0);
24     t.equal(subdeps, 0, "there should be no sub dependencies")
25     t.end()
26   })
27 })