feat(downloads): add option to limit amount of items (#3205)
This commit is contained in:
@@ -67,7 +67,7 @@ describe("Sabnzbd integration", () => {
|
||||
|
||||
// Acts
|
||||
const actAsync = async () => await sabnzbdIntegration.pauseQueueAsync();
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync();
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync({ limit: 99 });
|
||||
|
||||
// Assert
|
||||
await expect(actAsync()).resolves.not.toThrow();
|
||||
@@ -85,7 +85,7 @@ describe("Sabnzbd integration", () => {
|
||||
|
||||
// Acts
|
||||
const actAsync = async () => await sabnzbdIntegration.resumeQueueAsync();
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync();
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync({ limit: 99 });
|
||||
|
||||
// Assert
|
||||
await expect(actAsync()).resolves.not.toThrow();
|
||||
@@ -103,7 +103,7 @@ describe("Sabnzbd integration", () => {
|
||||
const sabnzbdIntegration = createSabnzbdIntegration(startedContainer, DEFAULT_API_KEY);
|
||||
|
||||
// Act
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync();
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync({ limit: 99 });
|
||||
|
||||
// Assert
|
||||
await expect(getAsync()).resolves.not.toThrow();
|
||||
@@ -122,7 +122,7 @@ describe("Sabnzbd integration", () => {
|
||||
await sabNzbdAddItemAsync(startedContainer, DEFAULT_API_KEY, sabnzbdIntegration);
|
||||
|
||||
// Act
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync();
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync({ limit: 99 });
|
||||
|
||||
// Assert
|
||||
await expect(getAsync()).resolves.not.toThrow();
|
||||
@@ -140,7 +140,7 @@ describe("Sabnzbd integration", () => {
|
||||
|
||||
// Act
|
||||
const actAsync = async () => await sabnzbdIntegration.pauseItemAsync(item);
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync();
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync({ limit: 99 });
|
||||
|
||||
// Assert
|
||||
await expect(getAsync()).resolves.toMatchObject({ items: [{ ...item, state: "downloading" }] });
|
||||
@@ -160,7 +160,7 @@ describe("Sabnzbd integration", () => {
|
||||
|
||||
// Act
|
||||
const actAsync = async () => await sabnzbdIntegration.resumeItemAsync(item);
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync();
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync({ limit: 99 });
|
||||
|
||||
// Assert
|
||||
await expect(getAsync()).resolves.toMatchObject({ items: [{ ...item, state: "paused" }] });
|
||||
@@ -180,7 +180,7 @@ describe("Sabnzbd integration", () => {
|
||||
// Act - fromDisk already doesn't work for sabnzbd, so only test deletion itself.
|
||||
const actAsync = async () =>
|
||||
await sabnzbdIntegration.deleteItemAsync({ ...item, progress: 0 } as DownloadClientItem, false);
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync();
|
||||
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync({ limit: 99 });
|
||||
|
||||
// Assert
|
||||
await expect(actAsync()).resolves.not.toThrow();
|
||||
@@ -242,7 +242,7 @@ const sabNzbdAddItemAsync = async (
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const {
|
||||
items: [item],
|
||||
} = await integration.getClientJobsAndStatusAsync();
|
||||
} = await integration.getClientJobsAndStatusAsync({ limit: 99 });
|
||||
if (item) return item;
|
||||
}
|
||||
// Throws if it can't find the item
|
||||
|
||||
Reference in New Issue
Block a user