UNPKG

hash-fns

Version:

easily create, assess, and assure hashes within a pit-of-success

31 lines 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const test_fns_1 = require("test-fns"); const asHashMd5_1 = require("./asHashMd5"); describe('asHashMd5', () => { (0, test_fns_1.given)('a known input string', () => { const input = 'hello world'; const expected = '5eb63bbbe01eeed093cb22bb8f5acdc3'; // verified MD5 of 'hello world' (0, test_fns_1.then)('it should return the correct md5 hash', async () => { const result = await (0, asHashMd5_1.asHashMd5)(input); expect(result).toBe(expected); }); }); (0, test_fns_1.given)('an empty string', () => { const input = ''; const expected = 'd41d8cd98f00b204e9800998ecf8427e'; // verified MD5 of '' (0, test_fns_1.then)('it should return the md5 hash of an empty string', async () => { const result = await (0, asHashMd5_1.asHashMd5)(input); expect(result).toBe(expected); }); }); (0, test_fns_1.given)('a unicode string', () => { const input = '你好世界'; const expected = '65396ee4aad0b4f17aacd1c6112ee364'; // verified MD5 of '你好世界' (0, test_fns_1.then)('it should return the correct md5 hash', async () => { const result = await (0, asHashMd5_1.asHashMd5)(input); expect(result).toBe(expected); }); }); }); //# sourceMappingURL=asHashMd5.test.js.map