-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correctly handle assign_scores_to config (fixes #69)
* includes deprecation warnings
- Loading branch information
Showing
9 changed files
with
189 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { describe, expect, test } from "vitest"; | ||
import yaml from "yaml"; | ||
import { transformConfig } from "./config"; | ||
import { InputConfigSchema } from "./types"; | ||
import { cloneWithJSON } from "./util"; | ||
|
||
describe("transformConfig", async () => { | ||
const config: InputConfigSchema = yaml.parse(` | ||
sonarr: | ||
instance1: | ||
base_url: http://sonarr:8989 | ||
api_key: test | ||
quality_profiles: | ||
- name: Remux-2160p - Anime | ||
quality_sort: top | ||
score_set: anime-sonarr | ||
upgrade: | ||
allowed: true | ||
until_quality: SINGLE_STAGE | ||
until_score: 5000000 | ||
qualities: | ||
- name: SINGLE_STAGE | ||
enabled: true | ||
qualities: | ||
- Bluray-2160p | ||
- SDTV | ||
- name: Unknown | ||
enabled: false | ||
custom_formats: | ||
- trash_ids: | ||
- custom-german-dl | ||
- custom-german-dl-2 | ||
assign_scores_to: | ||
- name: Remux-2160p - Anime | ||
radarr: {} | ||
`); | ||
|
||
test("should transform without error", async () => { | ||
const transformed = transformConfig(config); | ||
expect(transformed).not.toBeNull(); | ||
}); | ||
|
||
test("should transform without error - quality_profiles instead of assign_scores_to", async () => { | ||
const cloned = cloneWithJSON(config); | ||
const instance = cloned.sonarr["instance1"]; | ||
const { assign_scores_to, quality_profiles, ...rest } = instance.custom_formats[0]; | ||
|
||
instance.custom_formats[0] = { ...rest, quality_profiles: assign_scores_to ?? quality_profiles }; | ||
|
||
const transformed = transformConfig(config); | ||
expect(transformed).not.toBeNull(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.