test: tighten small command assertions

This commit is contained in:
Peter Steinberger
2026-05-10 00:28:15 +01:00
parent fc2834c217
commit dd27ad41a9
3 changed files with 13 additions and 17 deletions

View File

@@ -70,14 +70,13 @@ describe("buildProviderStatusIndex", () => {
);
expect(resolveAccount).not.toHaveBeenCalled();
expect(inspectAccount).toHaveBeenCalledWith({}, "work");
expect(map.get("workchat:work")).toMatchObject({
provider: "workchat",
accountId: "work",
state: "linked",
configured: true,
enabled: true,
name: "Work",
});
const status = map.get("workchat:work");
expect(status?.provider).toBe("workchat");
expect(status?.accountId).toBe("work");
expect(status?.state).toBe("linked");
expect(status?.configured).toBe(true);
expect(status?.enabled).toBe(true);
expect(status?.name).toBe("Work");
});
it("records accounts that throw during read-only resolution as not configured", async () => {

View File

@@ -154,9 +154,8 @@ describe("dashboardCommand", () => {
// hint string is written to runtime.log, which flows into the same
// console-captured log file readable by operator.read-scoped devices.
expect(formatControlUiSshHintMock).toHaveBeenCalledWith({ port: 18789, basePath: undefined });
expect(formatControlUiSshHintMock).not.toHaveBeenCalledWith(
expect.objectContaining({ token: expect.anything() }),
);
const [sshHintOptions] = formatControlUiSshHintMock.mock.calls[0] ?? [];
expect(sshHintOptions).not.toHaveProperty("token");
// Double-check: no logged line contains the secret.
for (const call of runtime.log.mock.calls) {

View File

@@ -56,11 +56,9 @@ describe("models/shared", () => {
update: { channel: "beta" },
}));
expect(mocks.replaceConfigFile).toHaveBeenCalledWith({
nextConfig: expect.objectContaining({
update: { channel: "beta" },
}),
baseHash: "config-1",
});
expect(mocks.replaceConfigFile).toHaveBeenCalledOnce();
const [replaceParams] = mocks.replaceConfigFile.mock.calls[0] ?? [];
expect(replaceParams?.nextConfig.update).toEqual({ channel: "beta" });
expect(replaceParams?.baseHash).toBe("config-1");
});
});