Performance: reduce json data transformations (#7175)

This commit is contained in:
shamoon
2026-09-23 15:32:30 -07:00
committed by GitHub
parent a7a4378a40
commit db480ca991
8 changed files with 85 additions and 25 deletions
+10 -1
View File
@@ -1,4 +1,4 @@
import { describe, it } from "vitest";
import { describe, expect, it } from "vitest";
import { expectWidgetConfigShape } from "test-utils/widget-config";
@@ -8,4 +8,13 @@ describe("gitea widget config", () => {
it("exports a valid widget config", () => {
expectWidgetConfigShape(widget);
});
it("splits issues and pull requests", () => {
const result = widget.mappings.issues.map(
Buffer.from(JSON.stringify([{ id: 1, pull_request: {} }, { id: 2 }, { id: 3 }])),
);
expect(result.pulls.map((i) => i.id)).toEqual([1]);
expect(result.issues.map((i) => i.id)).toEqual([2, 3]);
});
});