Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

test(navidrome): complete cleanup review (#6494)

Thomasade640dceac3
diff --git a/apps/docs/docs/widgets/audio-stats/index.mdx b/apps/docs/docs/widgets/audio-stats/index.mdx
index 50f32f5ec..88fa87f79 100644
--- a/apps/docs/docs/widgets/audio-stats/index.mdx
+++ b/apps/docs/docs/widgets/audio-stats/index.mdx
@@ -1,6 +1,6 @@
---
title: "Audio Stats"
-description: "Displays library statistics from Navidrome or Audiobookshelf, adapting its display based on the linked integration."
+description: "Displays media and listening statistics from Navidrome or Audiobookshelf, adapting its display based on the linked integration."
hide_title: true
---
diff --git a/packages/integrations/src/navidrome/test/navidrome-integration.spec.ts b/packages/integrations/src/navidrome/test/navidrome-integration.spec.ts
index 33912b395..08c66ad2a 100644
--- a/packages/integrations/src/navidrome/test/navidrome-integration.spec.ts
+++ b/packages/integrations/src/navidrome/test/navidrome-integration.spec.ts
@@ -1,6 +1,12 @@
+// @vitest-environment node
import { Response } from "undici";
import { beforeEach, describe, expect, test, vi } from "vitest";
+vi.hoisted(() => {
+ process.env.SKIP_ENV_VALIDATION = "true";
+ process.env.SECRET_ENCRYPTION_KEY = "0".repeat(64);
+});
+
import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
import type { IntegrationSecret } from "../../base/types";
@@ -39,19 +45,19 @@ const subsonicFailed = (message: string, code = 70) =>
"subsonic-response": { status: "failed", error: { code, message } },
});
+const makeAlbums = (count: number, songCount: number) =>
+ Array.from({ length: count }, (_, index) => ({
+ id: `album-${index}`,
+ name: `Album ${index}`,
+ songCount,
+ }));
+
beforeEach(() => {
mockFetch.mockReset();
});
describe("NavidromeIntegration.getDashboardDataAsync", () => {
test("paginates album list and counts songs", async () => {
- const makeAlbums = (count: number, songCount: number) =>
- Array.from({ length: count }, (_, i) => ({
- id: `album-${i}`,
- name: `Album ${i}`,
- songCount,
- }));
-
mockFetch.mockImplementation((url) => {
const urlStr = toUrlString(url);
@@ -84,7 +90,7 @@ describe("NavidromeIntegration.getDashboardDataAsync", () => {
>;
}
- return Promise.resolve(new Response(subsonicOk({}), { status: 200 })) as unknown as ReturnType<
+ return Promise.reject(new Error(`Unexpected dashboard request: ${urlStr}`)) as unknown as ReturnType<
typeof fetchWithTrustedCertificatesAsync
>;
});
@@ -113,7 +119,7 @@ describe("NavidromeIntegration.getDashboardDataAsync", () => {
) as unknown as ReturnType<typeof fetchWithTrustedCertificatesAsync>;
}
- return Promise.resolve(new Response(subsonicOk({}), { status: 200 })) as unknown as ReturnType<
+ return Promise.reject(new Error(`Unexpected dashboard request: ${urlStr}`)) as unknown as ReturnType<
typeof fetchWithTrustedCertificatesAsync
>;
});