refactor(xod-project): get rid of patch labels

This commit is contained in:
Evgeny Kochetkov
2017-04-19 18:36:08 +03:00
parent 95861f1b43
commit aaeb12afac
3 changed files with 0 additions and 51 deletions

View File

@@ -80,8 +80,6 @@ export const mergePatchesAndNodeTypes = R.converge(
]
);
// :: {} -> String
const getLabel = R.prop('label');
// :: {} -> [a]
const getNodes = propValues('nodes');
// :: {} -> [a]
@@ -99,10 +97,6 @@ const assocPatchUnsafe = R.curry(
(path, patch, project) => R.assocPath(['patches', path], patch, project)
);
// :: Patch -> Maybe fn
// fn :: Patch -> Patch
const addLabel = oldPatch => Maybe(getLabel(oldPatch)).map(Patch.setPatchLabel);
// :: String -> String
export const convertPinType = R.cond([
[R.equals('bool'), R.always('boolean')],
@@ -313,7 +307,6 @@ const convertPatches = R.compose(
return Tuple(nodeIdMap, assocNodes);
},
R.map(oldPatch => Maybe.of(Patch.createPatch())
.chain(apOrSkip(addLabel(oldPatch)))
.chain(apOrSkip(copyImpls(oldPatch)))
.map(convertPatchPins(oldPatch))
.map(convertNodes(oldPatch))

View File

@@ -43,31 +43,6 @@ export const duplicatePatch = def(
R.clone
);
/**
* @function getPatchLabel
* @param {Patch} patch
* @returns {string}
*/
export const getPatchLabel = def(
'getPatchLabel :: Patch -> Label',
// TODO: when label field is included in type definition, remove fallback to ''
R.propOr('', 'label')
);
/**
* @function setPatchLabel
* @param {string} label
* @param {Patch} patch
* @returns {Patch} a copy of the `patch` with new label
*/
export const setPatchLabel = def(
'setPatchLabel :: Label -> Patch -> Patch',
R.useWith(
R.assoc('label'),
[String, R.identity]
)
);
/**
* @function getPatchPath
* @param {Patch} patch

View File

@@ -56,25 +56,6 @@ describe('Patch', () => {
});
});
// properties
describe('getPatchLabel', () => {
it('should return patch label', () => {
const patch = Helper.defaultizePatch({ label: 'patchLabel' });
expect(Patch.getPatchLabel(patch)).to.be.equal('patchLabel');
});
});
describe('setPatchLabel', () => {
it('should return patch with new label', () => {
const newLabel = 'new label';
const patch = Helper.defaultizePatch({ label: 'old label' });
const newPatch = Patch.setPatchLabel(newLabel, patch);
expect(newPatch)
.to.have.property('label')
.that.is.a('string')
.that.equals(newLabel);
});
});
describe('listImpls', () => {
it('should return empty array for empty patch', () => {
expect(Patch.listImpls(emptyPatch))