@microsoft/useragent-sdk
Version:
SDK for building decentralized identity wallets and enterprise agents.
22 lines • 1.15 kB
JavaScript
;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const Multihash_1 = require("../../src/registrars/Multihash");
describe('Multihash', () => {
it('should throw on unsupported hash algorithm', () => {
const buffer = Buffer.from('Some content');
expect(() => Multihash_1.default.hash(buffer, 99)).toThrowError(`Hashing algorithm '99' not supported.`);
});
it('should return expected multihash', () => {
const buffer = Buffer.from('some document content');
const hash = Multihash_1.default.hash(buffer, 18);
expect(hash).toBeDefined();
expect(hash[0]).toEqual(18);
expect(hash[1]).toEqual(32);
expect(hash.length).toEqual(34);
});
});
//# sourceMappingURL=Multihash.spec.js.map