Merge pull request #21546 from timvandermeij/murmurhash-test

Implement a unit test for passing unsupported data types to `MurmurHash3_64.update()`
This commit is contained in:
Jonas Jenwald 2026-07-05 23:03:05 +02:00 committed by GitHub
commit 98ccc87fdc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -43,6 +43,12 @@ describe("MurmurHash3_64", function () {
hash.update(new Uint32Array(new Uint8Array(sourceCharCodes).buffer));
expect(hash.hexdigest()).toEqual(hexDigestExpected);
});
it("throws an exception for unsupported input types", function () {
const hash = new MurmurHash3_64();
expect(() => hash.update(42)).toThrow(
new Error("Invalid data format, must be a string or TypedArray.")
);
});
it("changes the hash after update without seed", function () {
const hash = new MurmurHash3_64();