Move makeTestToken to testing-utils

This commit is contained in:
Michael B. Gale
2026-01-24 12:55:32 +00:00
parent 0fcbec3eec
commit c12cf8d49a
2 changed files with 7 additions and 6 deletions
+1 -6
View File
@@ -15,14 +15,9 @@ import {
checkExpectedLogMessages,
getRecordingLogger,
LoggedMessage,
makeTestToken,
} from "./testing-utils";
function makeTestToken(length: number = 36) {
const chars =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
return chars.repeat(Math.ceil(length / chars.length)).slice(0, length);
}
test("makeTestToken", (t) => {
t.is(makeTestToken().length, 36);
t.is(makeTestToken(255).length, 255);
+6
View File
@@ -412,3 +412,9 @@ export function createTestConfig(overrides: Partial<Config>): Config {
overrides,
);
}
export function makeTestToken(length: number = 36) {
const chars =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
return chars.repeat(Math.ceil(length / chars.length)).slice(0, length);
}