Files
pleno-vue/tests/unit/vite-api-proxy.spec.js
T
Jeppe Bundgaard eaf4b965d5 Add runtime support for service sets, release management enhancements, and new unit tests
- Extend `releaseTimeline.js` and related modules for runtime-aware service sets and URLs.
- Update the release session builder to include `service_set` handling.
- Introduce release service definitions, status tones, and enhanced runtime display text.
- Add new dataset mode options, preview rows, and warnings for release configurations in `ConfigurationReleaseManager.vue`.
- Implement extensive utility methods for data service handling, target context, and deployment endpoints.
- Add `vite-api-proxy.spec.js` and extend `release-bootstrap.spec.js` to ensure coverage for new functionality.
2026-05-21 11:41:50 +02:00

35 lines
1.2 KiB
JavaScript

import { describe, expect, it } from "vitest";
import { createApiProxyOptions } from "../../vite.config.js";
describe("Vite API proxy", () => {
it("forwards local /api requests to the working dev API by default", () => {
const options = createApiProxyOptions({});
expect(options.target).toBe("https://api.truckwash.io:4433");
expect(options.changeOrigin).toBe(true);
expect(options.secure).toBe(false);
expect(options.rewrite("/api/ping")).toBe("/ping");
expect(options.rewrite("/api/release/runtime")).toBe("/release/runtime");
expect(options.rewrite("/api")).toBe("/");
});
it("allows a local gateway override", () => {
const options = createApiProxyOptions({
VITE_API_PROXY_TARGET: "http://localhost",
});
expect(options.target).toBe("http://localhost");
expect(options.rewrite("/api/ping")).toBe("/ping");
});
it("allows disabling prefix stripping for compatible local gateways", () => {
const options = createApiProxyOptions({
VITE_API_PROXY_TARGET: "http://localhost",
VITE_API_PROXY_STRIP_PREFIX: "false",
});
expect(options.target).toBe("http://localhost");
expect(options.rewrite).toBeUndefined();
});
});