Skip to content

Commit

Permalink
fixing tidyUpAnnotation logic and adding a test
Browse files Browse the repository at this point in the history
  • Loading branch information
tnrich committed Oct 19, 2021
1 parent 1c76930 commit 1d37492
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tidyUpAnnotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ module.exports = function tidyUpAnnotation(
if (
!annotation.type ||
typeof annotation.type !== "string" ||
FeatureTypes.some(function(featureType) {
if (featureType.toLowerCase === annotation.type.toLowerCase()) {
!FeatureTypes.some(function(featureType) {
if (featureType.toLowerCase() === annotation.type.toLowerCase()) {
annotation.type = featureType; //this makes sure the annotation.type is being set to the exact value of the accepted featureType
return true;
}
Expand Down
6 changes: 6 additions & 0 deletions src/tidyUpSequenceData.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ describe("tidyUpSequenceData", function() {
});
res.features[0].type.should.equal("misc_feature");
});
it("should add feature type = misc_feature if an invalid type is provided", function() {
const res = tidyUpSequenceData({
features: [{ start: 4, end: 5, type: "idontexist" }]
});
res.features[0].type.should.equal("misc_feature");
});
// it("should normalize strange upper/lower casing in feature types", function() {
// const res = tidyUpSequenceData(
// {
Expand Down

0 comments on commit 1d37492

Please sign in to comment.