mirror of
https://github.com/github/codeql-action.git
synced 2026-10-31 18:09:43 +00:00
Allow logging functions to accept string[] directly
This commit is contained in:
17
src/logging.test.ts
Normal file
17
src/logging.test.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import test from "ava";
|
||||
|
||||
import { joinMessageStrings } from "./logging";
|
||||
import { setupTests } from "./testing-utils";
|
||||
|
||||
setupTests(test);
|
||||
|
||||
test("joinMessageStrings", async (t) => {
|
||||
// For strings and errors, it is the identity function.
|
||||
t.deepEqual(joinMessageStrings("Hello"), "Hello");
|
||||
|
||||
const error = new Error("Some error");
|
||||
t.deepEqual(joinMessageStrings(error), error);
|
||||
|
||||
// For arrays of strings, we get a join-ed string.
|
||||
t.deepEqual(joinMessageStrings(["foo", "bar"]), "foo bar");
|
||||
});
|
||||
Reference in New Issue
Block a user