Skip to content

Commit daee991

Browse files
committed
Add printDebugLogs tests
1 parent 79e1b93 commit daee991

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎src/actions-util.test.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import {
77
isAnalyzingPullRequest,
88
isDefaultSetup,
99
isDynamicWorkflow,
10+
printDebugLogs,
1011
} from "./actions-util";
1112
import { computeAutomationID } from "./api-client";
1213
import { EnvVar } from "./environment";
1314
import { getRunnerLogger } from "./logging";
1415
import { setupTests } from "./testing-utils";
15-
import { initializeEnvironment } from "./util";
16+
import { initializeEnvironment, withTmpDir } from "./util";
1617

1718
setupTests(test);
1819

@@ -100,6 +101,19 @@ test("computeAutomationID()", async (t) => {
100101
);
101102
});
102103

104+
test("printDebugLogs - doesn't throw when config doesn't have needed properties", async (t) => {
105+
await t.notThrowsAsync(printDebugLogs({}));
106+
await t.notThrowsAsync(printDebugLogs({ languages: [] }));
107+
await t.notThrowsAsync(printDebugLogs({ dbLocation: "nowhere" }));
108+
});
109+
110+
test("printDebugLogs - doesn't throw when language db doesn't exist", async (t) =>
111+
withTmpDir(async (tmpDir) => {
112+
await t.notThrowsAsync(
113+
printDebugLogs({ dbLocation: tmpDir, languages: ["javascript"] }),
114+
);
115+
}));
116+
103117
test.serial("getPullRequestBranches() with pull request context", (t) => {
104118
withMockedContext(
105119
{

0 commit comments

Comments
 (0)