graph-cache
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -5,2 +5,3 @@ 'use strict'; | ||
var diff = require('lodash.differenceby'); | ||
var includes = require('lodash.includes'); | ||
@@ -10,3 +11,5 @@ function getDepencies(g, nodes, acc) { | ||
return nacc.concat(g.predecessors(node)); | ||
}, []); | ||
}, []).filter(function (el) { | ||
return !includes(acc, el); | ||
}); | ||
@@ -13,0 +16,0 @@ if (newNodes.length === 0) { |
const uniq = require('lodash.uniq'); | ||
const diff = require('lodash.differenceby'); | ||
const includes = require('lodash.includes'); | ||
function getDepencies(g, nodes, acc) { | ||
const newNodes = nodes.reduce((nacc, node) => | ||
nacc.concat(g.predecessors(node)), []); | ||
const newNodes = nodes | ||
.reduce((nacc, node) => nacc.concat(g.predecessors(node)), []) | ||
.filter((el) => !includes(acc, el)); | ||
@@ -8,0 +10,0 @@ if (newNodes.length === 0) { |
{ | ||
"name": "graph-cache", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "", | ||
@@ -25,2 +25,3 @@ "main": "index.js", | ||
"lodash.differenceby": "^4.6.0", | ||
"lodash.includes": "^4.3.0", | ||
"lodash.uniq": "^4.3.0", | ||
@@ -27,0 +28,0 @@ "object-assign": "^4.1.0" |
const chai = require('chai'); | ||
const chaiAsPromised = require('chai-as-promised'); | ||
const { loadTestFile, testSign, testGraph } = require('../utils/test_utils'); | ||
const { loadTestFile, testSign, testGraph, loadCyclicGraph } = require('../utils/test_utils'); | ||
@@ -29,3 +29,18 @@ chai.use(chaiAsPromised); | ||
it('can check cycle graphs not changed', () => | ||
loadCyclicGraph(true).then(([g, files, names]) => { | ||
return expect(checkFileCache(g, testSign, files[0], names[0])) | ||
.eventually.eql([]); | ||
}) | ||
); | ||
it('can check cycle graphs changed', () => | ||
loadCyclicGraph(true).then(([g, files, names]) => { | ||
g.setNode(names[1], 2123); | ||
return expect(checkFileCache(g, testSign, files[0], names[0])) | ||
.eventually.eql([names[1]]); | ||
}) | ||
); | ||
it('returns true if file has no deps and signatures match', () => | ||
@@ -32,0 +47,0 @@ loadTestFile('1.txt').then(([file, filename]) => { |
@@ -152,3 +152,3 @@ const chai = require('chai'); | ||
loadCyclicGraph().then(gg => { | ||
return updateGraph(g, testSign, loadCyclicGraph, '', getName(1)) | ||
return updateGraph(g, testSign, loadCyclicGraph.bind(null, false), '', getName(1)) | ||
.then(nwg => compareGraphs(nwg, gg)) | ||
@@ -155,0 +155,0 @@ }) |
@@ -90,5 +90,8 @@ const Graph = require('graphlib').Graph; | ||
function loadCyclicGraph() { | ||
return load2Graph().then((g) => { | ||
function loadCyclicGraph(info = false) { | ||
return load2Graph(true).then(([g, files, names]) => { | ||
g.setEdge(getName(1), getName(2)); | ||
if (info) { | ||
return [g, files, names]; | ||
} | ||
return g; | ||
@@ -95,0 +98,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48948
1493
6
+ Addedlodash.includes@^4.3.0
+ Addedlodash.includes@4.3.0(transitive)