mirror of
https://github.com/unraid/api.git
synced 2026-01-04 07:29:48 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced containerized plugin deployment support with updated Docker Compose configurations. - Added continuous build watch modes for API, web, and UI components for smoother development iterations. - Added a new job for API testing in the CI/CD workflow. - Added a new shell script to determine the local host's IP address for Docker configurations. - Introduced a new entry point and HTTP server setup in the plugin's Docker environment. - Added new scripts for building and watching plugin changes in real-time. - Added a new script for building the project in watch mode for the API and UI components. - **Improvements** - Streamlined the plugin installation process and refined release workflows for a more reliable user experience. - Enhanced overall CI/CD pipelines to ensure efficient, production-ready deployments. - Updated artifact upload paths and job definitions for clarity and efficiency. - Implemented new utility functions for better URL management and changelog generation. - Modified the `.dockerignore` file to ignore all contents within the `node_modules` directory. - Added new constants and functions for managing plugin paths and configurations. - Updated the build process in the Dockerfile to focus on release operations. - **Tests** - Expanded automated testing to validate environment setups and build stability, ensuring higher reliability during updates. - Introduced new test suites for validating plugin environment setups and configurations. - Added tests for validating environment variables and handling of manifest files. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Datelle <mdatelle@icloud.com> Co-authored-by: mdatelle <mike@datelle.net> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Pujit Mehrotra <pujit@lime-technology.com>
48 lines
1.7 KiB
TypeScript
48 lines
1.7 KiB
TypeScript
import { join } from "path";
|
|
import { validateTxzEnv, TxzEnv } from "../../cli/setup-txz-environment";
|
|
import { describe, it, expect, vi } from "vitest";
|
|
import { startingDir } from "../../utils/consts";
|
|
import { deployDir } from "../../utils/paths";
|
|
|
|
describe("setupTxzEnvironment", () => {
|
|
it("should return default values when no arguments are provided", async () => {
|
|
const envArgs = {};
|
|
const expected: TxzEnv = { ci: false, skipValidation: "false", compress: "1", txzOutputDir: join(startingDir, deployDir) };
|
|
|
|
const result = await validateTxzEnv(envArgs);
|
|
|
|
expect(result).toEqual(expected);
|
|
});
|
|
|
|
it("should parse and return provided environment arguments", async () => {
|
|
const envArgs = { ci: true, skipValidation: "true", txzOutputDir: join(startingDir, "deploy/release/test"), compress: '8' };
|
|
const expected: TxzEnv = { ci: true, skipValidation: "true", compress: "8", txzOutputDir: join(startingDir, "deploy/release/test") };
|
|
|
|
const result = await validateTxzEnv(envArgs);
|
|
|
|
expect(result).toEqual(expected);
|
|
});
|
|
|
|
it("should warn and skip validation when skipValidation is true", async () => {
|
|
const envArgs = { skipValidation: "true" };
|
|
const consoleWarnSpy = vi
|
|
.spyOn(console, "warn")
|
|
.mockImplementation(() => {});
|
|
|
|
await validateTxzEnv(envArgs);
|
|
|
|
expect(consoleWarnSpy).toHaveBeenCalledWith(
|
|
"skipValidation is true, skipping validation"
|
|
);
|
|
consoleWarnSpy.mockRestore();
|
|
});
|
|
|
|
it("should throw an error for invalid SKIP_VALIDATION value", async () => {
|
|
const envArgs = { skipValidation: "invalid" };
|
|
|
|
await expect(validateTxzEnv(envArgs)).rejects.toThrow(
|
|
"Must be true or false"
|
|
);
|
|
});
|
|
});
|