Repository URL to install this package:
|
Version:
1.4.3 ▾
|
import scriptHashes from './scriptHashes';
describe('getScriptHashes', () => {
test('it gets an array', () => {
expect(Array.isArray(scriptHashes)).toEqual(true);
});
test('it returns well-formed string hashes', () => {
expect.assertions(scriptHashes.length * 2);
const allowedPrefix = ['sha256-', 'sha384-', 'sha512-'];
scriptHashes.forEach(hash => {
const prefix = hash.substr(0, 7);
expect(allowedPrefix).toContain(prefix);
// Our base64 hashes should be 44 characters long.
expect(hash.length - prefix.length).toBe(44);
})
});
});