25 lines
860 B
TypeScript
25 lines
860 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("supports automatic discovery or a constrained pinned serial when enabled", () => {
|
|
expect(loadConfig({ NODE_ENV: "test", ADB_ENABLED: "true" }).adb).toMatchObject({ enabled: true, serial: null });
|
|
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"
|
|
});
|
|
});
|
|
});
|