test(desktop): cover WSL hashes through runtime resolution (#10285)
This commit is contained in:
1 parent
76f686d034
commit
cabac780f5
2 files changed
+1
-9
No files matched your search
@@ -218,14 +218,6 @@ const withPackagedWslHarness = <A, E, R>(
|
||||
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer));
|
||||
|
||||
describe("DesktopBackendConfiguration", () => {
|
||||
it("accepts only normalized SHA-256 archive identities", () => {
|
||||
assert.equal(
|
||||
DesktopBackendConfiguration.parseWslRuntimeArchiveHash(` ${"A".repeat(64)}\n`),
|
||||
"a".repeat(64),
|
||||
);
|
||||
assert.isNull(DesktopBackendConfiguration.parseWslRuntimeArchiveHash("abc123"));
|
||||
});
|
||||
|
||||
it.effect("resolvePrimary produces a stable scoped bootstrap token", () =>
|
||||
withHarness(
|
||||
Effect.gen(function* () {
|
||||
|
||||
@@ -243,7 +243,7 @@ const WSL_RUNTIME_ARCHIVE_NAME = "wsl-runtime.tar.gz";
|
||||
const WSL_RUNTIME_ARCHIVE_HASH_NAME = `${WSL_RUNTIME_ARCHIVE_NAME}.sha256`;
|
||||
const SHA256_HEX_PATTERN = /^[0-9a-f]{64}$/i;
|
||||
|
||||
export const parseWslRuntimeArchiveHash = (value: string): string | null => {
|
||||
const parseWslRuntimeArchiveHash = (value: string): string | null => {
|
||||
const trimmed = value.trim();
|
||||
return SHA256_HEX_PATTERN.test(trimmed) ? trimmed.toLowerCase() : null;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user