hash-fns
Version:
easily create, assess, and assure hashes within a pit-of-success
28 lines • 1.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const uni_time_1 = require("@ehmpathy/uni-time");
const test_fns_1 = require("test-fns");
const __1 = require("../..");
const isHashSha256_1 = require("./isHashSha256");
describe('isHashSha256', () => {
(0, test_fns_1.given)('a string', () => {
const bestBirthday = (0, uni_time_1.asUniDate)('2000-08-21');
(0, test_fns_1.when)('we hash it', () => {
const hashed = (0, __1.asHashSha256Sync)(bestBirthday);
(0, test_fns_1.then)('it should be a sha256 hash', () => {
expect((0, isHashSha256_1.isHashSha256)(hashed)).toBe(true);
});
});
});
(0, test_fns_1.given)('a string that is not a sha256 hash', () => {
const notAHash = 'not a hash';
(0, test_fns_1.when)('we assure that its a hash', () => {
(0, test_fns_1.then)('it should throw an error', () => {
const error = (0, test_fns_1.getError)(() => isHashSha256_1.isHashSha256.assure(notAHash));
console.log(error);
expect(error.message).toContain('assure.rejection: input does not satisfy type.check');
});
});
});
});
//# sourceMappingURL=isHashSha256.test.js.map