Commit fc61d68e authored by Jaden DIEFENBAUGH's avatar Jaden DIEFENBAUGH
Browse files

[js][tc] fix #144 & add tests

parent 727ad08e
......@@ -84,7 +84,7 @@ class ToolchainConnection extends React.Component<Props> {
render = () => {
const conn = this.props.connection;
const connectionId = `#${ connectionToId(conn) }`;
const connectionId = `${ connectionToId(conn) }`;
const fromLoc = this.props.fromLocMap;
const toLoc = this.props.toLocMap;
//console.log(`connecting "${ connId }" from ${ fromInfo } to ${ toInfo }`);
......
......@@ -986,5 +986,33 @@ describe('<ToolchainEditor />', function() {
expect(data.contents.representation.connections).to.have.property('training_alg.lda/testing_alg.lda_machine');
expect(data.contents.representation.connections).to.not.have.property('training_alg.lda_machine/testing_alg.lda_machine');
});
it('Properly deletes the training_data.species/training_alg.species connection', async () => {
const conToDel = { from: 'training_data.species', to: 'training_alg.species', channel: 'training_data' };
const tc = getValidObj(getIrisTc());
wrapper = mount(
<C
data={tc}
sets={sets}
protocols={protocols}
toolchains={state.toolchain}
databases={state.database}
normalAlgorithms={normalAlgorithms}
analyzerAlgorithms={analyzerAlgorithms}
saveFunc={saveFunc}
updateFunc={updateFunc}
/>
);
// change testing_alg.lda_machine to testing_alg.lda
expect(wrapper.exists('#training_data-species-training_alg-species')).to.equal(true);
wrapper.instance().handleConnectionContextMenu({}, { clicked: 'delete', connection: conToDel });
wrapper.update();
expect(wrapper.exists('#training_data-species-training_alg-species')).to.equal(false);
const data = wrapper.props().data;
expect(data.contents.representation.connections).to.not.have.property('training_data.species/training_data.species');
expect(data.contents.connections.findIndex(c => c.from == conToDel.from && c.to == conToDel.to)).to.equal(-1);
});
});
});
......@@ -12,7 +12,7 @@ const sleep = (ms) => {
return new Promise(resolve => setTimeout(resolve, ms));
};
describe.only('<ToolchainModal />', () => {
describe('<ToolchainModal />', () => {
let wrapper;
afterEach(() => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment