Skip to content

Commit

Permalink
feat(utils): increase slugify max-length to 150
Browse files Browse the repository at this point in the history
  • Loading branch information
fkm-adfinis authored and fkm committed Feb 21, 2020
1 parent 65323d1 commit 5c2093e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion addon/utils/slugify.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import slugify from "slugify";
export default function(value) {
return slugify(value.toLowerCase(), {
remove: /((?![a-z0-9-\s]).)/g
}).substr(0, 50);
}).substr(0, 150);
}
9 changes: 3 additions & 6 deletions tests/unit/utils/slugify-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ module("Unit | Utility | slugify", function(/*hooks*/) {
slugify("test with special characters #?%/()"),
"test-with-special-characters-percent"
);
});

assert.equal(
slugify(
"test with more characters than 50 which is the maximum for a slug"
),
"test-with-more-characters-than-50-which-is-the-max"
);
test("it truncates string with more than 150 characters", function(assert) {
assert.equal(slugify("0123456789".repeat(20)).length, 150);
});
});

0 comments on commit 5c2093e

Please sign in to comment.