Add remove hashtags setting
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const tap = require("tap")
|
||||
const {structure, partsHashtag, partsUsername} = require("../src/lib/utils/structuretext.js")
|
||||
const {structure, partsHashtag, partsUsername, removeTrailingHashtags} = require("../src/lib/utils/structuretext.js")
|
||||
|
||||
// lone test hashtag
|
||||
tap.same(
|
||||
@@ -154,3 +154,91 @@ tap.test("entire structure works", childTest => {
|
||||
|
||||
childTest.end()
|
||||
})
|
||||
|
||||
tap.test("remove trailing hashtags", childTest => {
|
||||
childTest.same(
|
||||
removeTrailingHashtags(structure(
|
||||
"Happy earth day folks #flyingfish"
|
||||
)),
|
||||
[
|
||||
{type: "text", text: "Happy earth day folks"}
|
||||
],
|
||||
"earth day"
|
||||
)
|
||||
|
||||
childTest.same(
|
||||
removeTrailingHashtags(structure(
|
||||
"🍌HELLO OLIVE HERE🍌...and we have been working hard on this magic trick for youuuUuu."
|
||||
+ "\n."
|
||||
+ "\n. ."
|
||||
+ "\n."
|
||||
+ "\n."
|
||||
+ "\n#guineapig #cavy #guineapigs #guineapigsofinstagram #cute #babyanimals #cavylove #babyguineapig #guineapigsof_ig #cavy #thedodo #spoiltpets #funny #pets #guineapigpopcorning #popcorning #guineapigsleeping #vipmischief #tiktok #tiktokmemes"
|
||||
)),
|
||||
[
|
||||
{type: "text", text: "🍌HELLO OLIVE HERE🍌...and we have been working hard on this magic trick for youuuUuu."}
|
||||
],
|
||||
"olive"
|
||||
)
|
||||
|
||||
childTest.same(
|
||||
removeTrailingHashtags(structure(
|
||||
"PINK HOUSE. ."
|
||||
+ "\n."
|
||||
+ "\n."
|
||||
+ "\n."
|
||||
+ "\n."
|
||||
+ "\n."
|
||||
+ "\n#antireality #archicage #arqsketch #thebna #next_top_architects #architecturedose #architecture_hunter #morpholio #archdaily #designboom #arch_more #designmilk #arch_impressive #designwanted #nextarch #dezeen #amazingarchitecture #koozarch #superarchitects #thearchitecturestudentblog #architecturestudents #architecturefactor #allofarchitecture #archinect #soarch #"
|
||||
)),
|
||||
[
|
||||
{type: "text", text: "PINK HOUSE."}
|
||||
],
|
||||
"pink house"
|
||||
)
|
||||
|
||||
childTest.same(
|
||||
removeTrailingHashtags(structure(
|
||||
"This some research I’ve been doing for #FuturePlay at @futuredeluxe together with @curtisbaigent Expressive Computer Vision #1"
|
||||
)),
|
||||
[
|
||||
{type: "text", text: "This some research I’ve been doing for "},
|
||||
{type: "hashtag", text: "#FuturePlay", hashtag: "FuturePlay"},
|
||||
{type: "text", text: " at "},
|
||||
{type: "user", text: "@futuredeluxe", user: "futuredeluxe"},
|
||||
{type: "text", text: " together with "},
|
||||
{type: "user", text: "@curtisbaigent", user: "curtisbaigent"},
|
||||
{type: "text", text: " Expressive Computer Vision"}
|
||||
],
|
||||
"computer vision"
|
||||
)
|
||||
|
||||
childTest.same(
|
||||
removeTrailingHashtags(structure(
|
||||
"It is a flourishing building in"
|
||||
+ "\nthe midst of a great bustling city."
|
||||
+ "\nPeople will get out from difficulty,"
|
||||
+ "\nand this will be the resurrection time."
|
||||
+ "\n#hellofrom Chongqing China"
|
||||
+ "\n・"
|
||||
+ "\n・"
|
||||
+ "\n・"
|
||||
+ "\n・"
|
||||
+ "\n#earthfocus #earthoffcial #earthpix #discoverearth #lifeofadventure #livingonearth #theweekoninstagram #theglobewanderer #visualambassadors #welivetoexplore #IamATraveler #wonderful_places #TLPics #depthobsessed #voyaged @sonyalpha @hypebeast @highsnobiety @lightroom @soul.planet @earthfever @9gag @500px"
|
||||
)),
|
||||
[
|
||||
{type: "text", text:
|
||||
"It is a flourishing building in"
|
||||
+ "\nthe midst of a great bustling city."
|
||||
+ "\nPeople will get out from difficulty,"
|
||||
+ "\nand this will be the resurrection time."
|
||||
+ "\n"
|
||||
},
|
||||
{type: "hashtag", text: "#hellofrom", hashtag: "hellofrom"},
|
||||
{type: "text", text: " Chongqing China"}
|
||||
],
|
||||
"chongquing china"
|
||||
)
|
||||
|
||||
childTest.end()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user