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: adjust nzbget test to use append instead of scan (#1952)
Meier Lukas4d94fce523ff
diff --git a/package.json b/package.jsonindex 04cf9ee28..601753572 100644--- a/package.json+++ b/package.json@@ -22,9 +22,9 @@"lint:ws": "pnpm dlx sherif@latest","package:new": "turbo gen init","release": "semantic-release",- "test": "cross-env NODE_ENV=development vitest run --exclude e2e --coverage.enabled ",- "test:e2e": "cross-env NODE_ENV=development vitest e2e",- "test:ui": "cross-env NODE_ENV=development vitest --exclude e2e --ui --coverage.enabled",+ "test": "cross-env NODE_ENV=development CI=true vitest run --exclude e2e --coverage.enabled ",+ "test:e2e": "cross-env NODE_ENV=development CI=true vitest e2e",+ "test:ui": "cross-env NODE_ENV=development CI=true vitest --exclude e2e --ui --coverage.enabled","typecheck": "turbo typecheck","with-env": "dotenv -e .env --"},diff --git a/packages/integrations/test/nzbget.spec.ts b/packages/integrations/test/nzbget.spec.tsindex 9241c5a52..c30008a99 100644--- a/packages/integrations/test/nzbget.spec.ts+++ b/packages/integrations/test/nzbget.spec.ts@@ -1,3 +1,4 @@+import { readFile } from "fs/promises";import { join } from "path";import type { StartedTestContainer } from "testcontainers";import { GenericContainer, getContainerRuntimeClient, ImageName, Wait } from "testcontainers";@@ -169,29 +170,34 @@ const nzbGetAddItemAsync = async (password: string,integration: NzbGetIntegration,) => {- // Add nzb file in the watch folder- await container.copyFilesToContainer([- {- source: join(__dirname, "/volumes/usenet/test_download_100MB.nzb"),- target: "/downloads/nzb/test_download_100MB.nzb",- },- ]);+ const fileContent = await readFile(join(__dirname, "/volumes/usenet/test_download_100MB.nzb"), "base64");// Trigger scanning of the watch folder (Only available way to add an item except "append" which is too complex and unnecessary)await fetch(`http://${container.getHost()}:${container.getMappedPort(6789)}/${username}:${password}/jsonrpc`, {method: "POST",- body: JSON.stringify({ method: "scan" }),+ body: JSON.stringify({+ method: "append",+ params: [+ "/downloads/nzb/test_download_100MB.nzb", // NZBFilename+ fileContent, // Content+ "", // Category+ 0, // Priority+ true, // AddToTop+ false, // Paused+ "random", // DupeKey+ 1000, // DupeScore+ "all", // DupeMode+ [], // PPParameters+ ],+ }),});- // Retries up to 10000 times to let NzbGet scan and process the nzb (1 retry should suffice tbh but NzbGet is slow)- for (let i = 0; i < 10000; i++) {- const {- items: [item],- } = await integration.getClientJobsAndStatusAsync();- if (item) {- // Remove the added time because NzbGet doesn't return it properly in this specific case- const { added: _, ...itemRest } = item;- return itemRest;- }++ const {+ items: [item],+ } = await integration.getClientJobsAndStatusAsync();++ if (!item) {+ throw new Error("No item found");}- // Throws if it can't find the item- throw new Error("No item found");++ return item;};