Add test coverage for deleting a flow

This commit is contained in:
Nick O'Leary 2017-05-11 15:39:55 +01:00
parent c0eabf0438
commit c75dc3cc36
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 20 additions and 0 deletions

View File

@ -661,6 +661,26 @@ describe('flows/util', function() {
diffResult.removed.should.have.length(0);
diffResult.rewired.should.have.length(0);
});
it('marks a deleted tab as removed', function() {
var config = [{id:"f1",type:"tab",label:"fred"},{id:"n1",type:"test",bar:"b",wires:[["1"]],z:"f1"},
{id:"f2",type:"tab",label:"fred"},{id:"n2",type:"test",bar:"b",wires:[["1"]],z:"f2"}];
var newConfig = clone(config);
newConfig = newConfig.slice(0,2);
var originalConfig = flowUtil.parseConfig(config);
var changedConfig = flowUtil.parseConfig(newConfig);
originalConfig.missingTypes.should.have.length(0);
var diffResult = flowUtil.diffConfigs(originalConfig,changedConfig);
diffResult.added.should.have.length(0);
diffResult.changed.should.have.length(0);
diffResult.removed.sort().should.eql(['f2', 'n2']);
diffResult.rewired.should.have.length(0);
});
it('marks all nodes as added when tab state changes disabled to enabled', function() {
var config = [{id:"1",type:"tab",disabled:true,label:"fred"},{id:"2",type:"test",bar:"b",wires:[["1"]],z:"1"},{id:"3",type:"test"}];
var newConfig = clone(config);