Skip to content

Commit c58ce53

Browse files
committed
test: tighten hermes secret item assertions
1 parent e14bba5 commit c58ce53

1 file changed

Lines changed: 33 additions & 18 deletions

File tree

extensions/migrate-hermes/secrets.test.ts

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,22 @@ describe("Hermes migration secret items", () => {
4545
);
4646

4747
expect(plan.metadata?.agentDir).toBe(customAgentDir);
48-
expect(plan.items).toEqual(
49-
expect.arrayContaining([
50-
expect.objectContaining({
51-
id: "secret:openai",
52-
target: `${customAgentDir}/auth-profiles.json#openai:hermes-import`,
53-
status: "planned",
54-
}),
55-
]),
56-
);
48+
expect(plan.items).toEqual([
49+
{
50+
id: "secret:openai",
51+
kind: "secret",
52+
action: "create",
53+
source: path.join(source, ".env"),
54+
target: `${customAgentDir}/auth-profiles.json#openai:hermes-import`,
55+
status: "planned",
56+
sensitive: true,
57+
details: {
58+
envVar: "OPENAI_API_KEY",
59+
provider: "openai",
60+
profileId: "openai:hermes-import",
61+
},
62+
},
63+
]);
5764

5865
const result = await provider.apply(
5966
makeContext({
@@ -141,15 +148,23 @@ describe("Hermes migration secret items", () => {
141148

142149
const result = await provider.apply(ctx, plan);
143150

144-
expect(result.items).toEqual(
145-
expect.arrayContaining([
146-
expect.objectContaining({
147-
id: "secret:openai",
148-
status: "conflict",
149-
reason: HERMES_REASON_AUTH_PROFILE_EXISTS,
150-
}),
151-
]),
152-
);
151+
expect(result.items).toEqual([
152+
{
153+
id: "secret:openai",
154+
kind: "secret",
155+
action: "create",
156+
source: path.join(source, ".env"),
157+
target: `${agentDir}/auth-profiles.json#openai:hermes-import`,
158+
status: "conflict",
159+
sensitive: true,
160+
reason: HERMES_REASON_AUTH_PROFILE_EXISTS,
161+
details: {
162+
envVar: "OPENAI_API_KEY",
163+
provider: "openai",
164+
profileId: "openai:hermes-import",
165+
},
166+
},
167+
]);
153168
expect(result.summary.conflicts).toBe(1);
154169
const authStore = JSON.parse(
155170
await fs.readFile(path.join(agentDir, "auth-profiles.json"), "utf8"),

0 commit comments

Comments
 (0)