• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

iamogbz / letters-from-the-abyss / #55

04 Mar 2024 01:47AM UTC coverage: 56.281%. Remained the same
#55

push

iamogbz
wip: add poem share functionality

9 of 29 branches covered (31.03%)

Branch coverage included in aggregate %.

1 of 30 new or added lines in 3 files covered. (3.33%)

10 existing lines in 2 files now uncovered.

103 of 170 relevant lines covered (60.59%)

8.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

5.56
/src/utils/hitCounter.ts
1
export const Keys = {
2✔
2
  PAGE_VISIT: "page-visit",
3
  POEM_LIKE: "poem-like",
4
};
5

6
export function pageKey(part: string) {
7
  const pathWithHash = `${
×
8
    window.location.pathname
9
  }${part}-hash-${window.location.hash.replace("#", "")}`;
10
  return pathWithHash;
×
11
}
12

13
export function apiLogCount(countKey: string) {
14
  return `https://api.letters-from-the-abyss.com/counter${countKey}`;
×
15
}
16

17
export async function logPageVisit() {
NEW
18
  try {
×
NEW
19
    await fetch(apiLogCount(pageKey(Keys.PAGE_VISIT)));
×
20
  } catch (e) {
NEW
21
    console.error(e);
×
22
  }
23
}
24

25
export function isPageLocallyLiked() {
UNCOV
26
  const likey = pageKey(Keys.POEM_LIKE);
×
UNCOV
27
  try {
×
UNCOV
28
    return JSON.parse(window.localStorage.getItem(likey) || "false");
×
29
  } catch {
30
    return false;
×
31
  }
32
}
33

34
export async function logPoemLike() {
UNCOV
35
  const likey = pageKey(Keys.POEM_LIKE);
×
NEW
36
  try {
×
NEW
37
    await fetch(apiLogCount(likey));
×
NEW
38
    window.localStorage.setItem(likey, "true");
×
39
  } catch (e) {
NEW
40
    console.error(e);
×
41
  }
42
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc