You are viewing a single comment's thread from:
RE: [Development] Fix issue on steemhunt/web where using symbols other than @ before a username makes a mention invalid
Hey @superoo7,
it's good to see that some devs here are using const
and quite a good code style, I appreciate that. Mostly I see bad formatted code and tons of bad practices happening around here.
I also like that you provided tests, I just want to give you a small example on how to remove the hardcoded test1, test2, test3
declarations plus the 5 lines for the expectations:
const testCases = [
{
test: base('something @superoo7 something'),
expect: base(`<span>something ${aTag} something</span>`),
},
{
test: base('something [@superoo7 something'),
expect: base(`<span>something [${aTag} something</span>`),
},
...
];
testCases.forEach(({ test, expect }) => {
expect(HtmlReady(test).html).toEqual(expect)
});
And you can remove the console.log
inside the testcase.
What do you think about it? :)
Appreciate your comment on my development post. Yea you are correct, I hard coded that because I didn't think much about, now looking back at it, it looks a bit of repeating of using
test1, test2
. Thanks for the comment again, will fix that code soon.