allow a node's icon to be set dynamically (#1490)

* create a proto type

* Fixed some problems after reviewing
This commit is contained in:
Kazuki Nakanishi
2017-11-30 13:13:35 +00:00
committed by Nick O'Leary
parent cc88ebd2b9
commit 6d2389945b
16 changed files with 367 additions and 19 deletions

View File

@@ -50,6 +50,7 @@ describe("nodes api", function() {
app.get(/\/nodes\/((@[^\/]+\/)?[^\/]+)\/([^\/]+)$/,nodes.getSet);
app.put(/\/nodes\/((@[^\/]+\/)?[^\/]+)$/,nodes.putModule);
app.put(/\/nodes\/((@[^\/]+\/)?[^\/]+)\/([^\/]+)$/,nodes.putSet);
app.get("/getIcons",nodes.getIcons);
app.delete("/nodes/:id",nodes.delete);
sinon.stub(locales,"determineLangFromHeaders", function() {
return "en-US";
@@ -808,5 +809,29 @@ describe("nodes api", function() {
});
});
describe('get icons', function() {
it('returns icon list', function(done) {
debugger;
initNodes({
nodes:{
getNodeIcons: function() {
return {"module":["1.png","2.png","3.png"]};
}
}
});
request(app)
.get('/getIcons')
.expect(200)
.end(function(err,res) {
if (err) {
throw err;
}
console.log(res.body);
res.body.should.have.property("module");
res.body.module.should.be.an.Array();
res.body.module.should.have.lengthOf(3);
done();
});
});
});
});