mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge pull request #4578 from kazuhitoyokoi/master-fiximportdialog
Fix example flow name in import dialog
This commit is contained in:
commit
9a32ebd0c0
@ -36,7 +36,7 @@ async function getFlowsFromPath(path) {
|
|||||||
promises.push(getFlowsFromPath(fullPath));
|
promises.push(getFlowsFromPath(fullPath));
|
||||||
} else if (/\.json$/.test(file)){
|
} else if (/\.json$/.test(file)){
|
||||||
validFiles.push(file);
|
validFiles.push(file);
|
||||||
promises.push(Promise.resolve(file.split(".")[0]))
|
promises.push(Promise.resolve(file.replace(/\.json$/, '')))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -33,16 +33,15 @@ describe("library api", function() {
|
|||||||
should.not.exist(library.getExampleFlowPath('foo','bar'));
|
should.not.exist(library.getExampleFlowPath('foo','bar'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns a valid example path', function(done) {
|
it('returns valid example paths', function(done) {
|
||||||
library.init();
|
library.init();
|
||||||
library.addExamplesDir("test-module",path.resolve(__dirname+'/resources/examples')).then(function() {
|
library.addExamplesDir("test-module",path.resolve(__dirname+'/resources/examples')).then(function() {
|
||||||
try {
|
try {
|
||||||
var flows = library.getExampleFlows();
|
var flows = library.getExampleFlows();
|
||||||
flows.should.deepEqual({"test-module":{"f":["one"]}});
|
flows.should.deepEqual({"test-module":{"f":["1.2.3","one"]}});
|
||||||
|
|
||||||
var examplePath = library.getExampleFlowPath('test-module','one');
|
var examplePath = library.getExampleFlowPath('test-module','one');
|
||||||
examplePath.should.eql(path.resolve(__dirname+'/resources/examples/one.json'))
|
examplePath.should.eql(path.resolve(__dirname+'/resources/examples/one.json'));
|
||||||
|
|
||||||
|
|
||||||
library.removeExamplesDir('test-module');
|
library.removeExamplesDir('test-module');
|
||||||
|
|
||||||
@ -57,6 +56,5 @@ describe("library api", function() {
|
|||||||
done(err);
|
done(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user