25 lines
819 B
TypeScript
25 lines
819 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { loadConfig } from "../src/config.js";
|
|
|
|
describe("ADB configuration", () => {
|
|
it("is disabled by default", () => {
|
|
expect(loadConfig({ NODE_ENV: "test" }).adb).toEqual({
|
|
enabled: false,
|
|
executable: "adb",
|
|
serial: null,
|
|
timeoutMs: 3_000
|
|
});
|
|
});
|
|
|
|
it("requires a constrained serial when enabled", () => {
|
|
expect(() => loadConfig({ NODE_ENV: "test", ADB_ENABLED: "true" })).toThrow("ADB_SERIAL is required");
|
|
expect(() =>
|
|
loadConfig({ NODE_ENV: "test", ADB_ENABLED: "true", ADB_SERIAL: "serial; shell command" })
|
|
).toThrow();
|
|
expect(loadConfig({ NODE_ENV: "test", ADB_ENABLED: "true", ADB_SERIAL: "10.0.0.10:5555" }).adb).toMatchObject({
|
|
enabled: true,
|
|
serial: "10.0.0.10:5555"
|
|
});
|
|
});
|
|
});
|