Skip to content

Commit 5180102

Browse files
committed
fix(hugo): detect overnight postpartum support requests
1 parent d1cb26b commit 5180102

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { describe, expect, it } from "bun:test";
2+
import { detectDoulaRequest } from "./detect-doula-request.js";
3+
4+
describe("detectDoulaRequest", () => {
5+
it("detects requests for overnight postpartum help after a c section", () => {
6+
const message =
7+
"My name is Veronica and I’m based in Victor, NY. I had a baby 2.5 weeks ago via c section and I’m struggling very badly with the lack of sleep manifesting very physically for me. I am looking for overnight help maybe 2 nights a week to try and repair myself by getting rest. Looking forward to hearing if someone is available. Thank you so much.";
8+
9+
expect(detectDoulaRequest(message)).toBe(true);
10+
});
11+
12+
it("does not detect generic baby messages without support-seeking language", () => {
13+
const message =
14+
"I had my baby recently and have a question about updating my newsletter email address.";
15+
16+
expect(detectDoulaRequest(message)).toBe(false);
17+
});
18+
});

hugo/assets/ts/detect-doula-request.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ const weakSignals = [
2323
"birthing",
2424
"prenatal",
2525
"newborn",
26+
"overnight help",
27+
"overnight support",
28+
"lack of sleep",
29+
"c section",
2630
"lactation",
2731
"breastfeeding",
2832
"c-section",

0 commit comments

Comments
 (0)