feeds-fun 1.26.1 → 1.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feeds-fun",
3
- "version": "1.26.1",
3
+ "version": "1.27.1",
4
4
  "author": "Aliaksei Yaletski (Tiendil) <a.eletsky@gmail.com> (https://tiendil.org/)",
5
5
  "description": "Frontend for the Feeds Fun — web-based news reader",
6
6
  "keywords": [
@@ -148,11 +148,13 @@ export const MinNewsTagCountProperties = new Map<MinNewsTagCount, MinNewsTagCoun
148
148
  /////////
149
149
 
150
150
  export enum Marker {
151
- Read = "read"
151
+ Read = 1,
152
+ CanSeeTags = 2
152
153
  }
153
154
 
154
- export const reverseMarker: {[key: string]: Marker} = {
155
- read: Marker.Read
155
+ export const reverseMarker: {[key: number]: Marker} = {
156
+ [Marker.Read]: Marker.Read,
157
+ [Marker.CanSeeTags]: Marker.CanSeeTags
156
158
  };
157
159
 
158
160
  /////////////////////
@@ -0,0 +1,30 @@
1
+ import {describe, expect, it} from "vitest";
2
+
3
+ import * as e from "@/logic/enums";
4
+ import {entryFromJSON, type RawEntry} from "@/logic/types";
5
+
6
+ function rawEntry(markers: number[]): RawEntry {
7
+ return {
8
+ id: "ed278ccf-f8e3-4e8b-b065-1ad120444b47",
9
+ feedId: "dca40ac1-73da-49dc-b7d8-40dac312ae40",
10
+ title: "Entry",
11
+ url: "https://example.com/entry",
12
+ tags: [],
13
+ markers,
14
+ score: 0,
15
+ scoreContributions: {},
16
+ publishedAt: "2026-05-11T12:00:00Z"
17
+ };
18
+ }
19
+
20
+ describe("entryFromJSON", () => {
21
+ it("translates integer markers to frontend enum values", () => {
22
+ const entry = entryFromJSON(rawEntry([1, 2]), {});
23
+
24
+ expect(entry.markers).toEqual([e.Marker.Read, e.Marker.CanSeeTags]);
25
+ });
26
+
27
+ it("rejects unknown integer markers", () => {
28
+ expect(() => entryFromJSON(rawEntry([100]), {})).toThrow("Unknown marker: 100");
29
+ });
30
+ });
@@ -290,7 +290,7 @@ export type RawEntry = {
290
290
  title: string;
291
291
  url: string;
292
292
  tags: number[];
293
- markers: string[];
293
+ markers: number[];
294
294
  score: number;
295
295
  scoreContributions: {[key: number]: number};
296
296
  publishedAt: string;
@@ -311,7 +311,7 @@ export function entryFromJSON(rawEntry: RawEntry, tagsMapping: {[key: number]: s
311
311
  title: rawEntry.title,
312
312
  url: toURL(rawEntry.url),
313
313
  tags: rawEntry.tags.map((t: number) => tagsMapping[t]),
314
- markers: rawEntry.markers.map((m: string) => {
314
+ markers: rawEntry.markers.map((m: number) => {
315
315
  if (m in e.reverseMarker) {
316
316
  return e.reverseMarker[m];
317
317
  }