diff --git a/front-end/components/bloom.mjs b/front-end/components/bloom.mjs
index 0b4166c3..eaecfd8f 100644
--- a/front-end/components/bloom.mjs
+++ b/front-end/components/bloom.mjs
@@ -34,10 +34,10 @@ const createBloom = (template, bloom) => {
return bloomFrag;
};
-function _formatHashtags(text) {
+export function _formatHashtags(text) {
if (!text) return text;
return text.replace(
- /\B#[^#]+/g,
+ /\B#[^#\s]+/g,
(match) => `${match}`
);
}
diff --git a/front-end/tests/bloom.spec.mjs b/front-end/tests/bloom.spec.mjs
new file mode 100644
index 00000000..33566496
--- /dev/null
+++ b/front-end/tests/bloom.spec.mjs
@@ -0,0 +1,26 @@
+import { test, expect } from "@playwright/test";
+import { _formatHashtags } from "../components/bloom.mjs";
+
+test.describe("Bloom Component", () => {
+ test("should format a single hashtag in a bloom", () => {
+ const text = "Test #do";
+ const result = _formatHashtags(text);
+ expect(result).toContain('#do');
+ });
+
+ test("should format multiple hashtags in a bloom", () => {
+ const text = "Tech is magic #blessed #TechLife";
+ const result = _formatHashtags(text);
+ expect(result).toContain('#blessed');
+ expect(result).toContain('#TechLife');
+ });
+
+ test("should not include word after hashtag that is not a hashtag", () => {
+ const text = "Let's get some #SwizBiz love!!";
+ const result = _formatHashtags(text);
+ expect(result).toContain('#SwizBiz');
+ expect(result).not.toContain(
+ '#SwizBiz love!!',
+ );
+ });
+});