Skip to content

Commit

Permalink
[TEST] fix tests referencing old digest prefix (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart committed Oct 10, 2022
1 parent 6582a93 commit 80aa72c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/objectstore_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { equals } from "https://deno.land/std@0.152.0/bytes/mod.ts";
import { ObjectInfo, ObjectStoreMeta } from "../nats-base-client/types.ts";
import { SHA256 } from "../nats-base-client/sha256.js";
import { Base64UrlCodec } from "../nats-base-client/base64.ts";
import { digestType } from "../nats-base-client/objectstore.ts";

function readableStreamFrom(data: Uint8Array): ReadableStream<Uint8Array> {
return new ReadableStream<Uint8Array>({
Expand Down Expand Up @@ -84,7 +85,7 @@ function digest(data: Uint8Array): string {
const digest = sha.digest("base64");
const pad = digest.length % 3;
const padding = pad > 0 ? "=".repeat(pad) : "";
return `sha-256=${digest}${padding}`;
return `${digestType}${digest}${padding}`;
}

Deno.test("objectstore - basics", async () => {
Expand Down Expand Up @@ -844,7 +845,7 @@ Deno.test("objectstore - hashtests", async () => {
{ name: t.hash, options: { max_chunk_size: 9 } },
rs.stream(),
);
assertEquals(oi.digest, `sha-256=${t.hash}`);
assertEquals(oi.digest, `${digestType}${t.hash}`);
}

await cleanup(ns, nc);
Expand Down

0 comments on commit 80aa72c

Please sign in to comment.