UNPKG

identify-media

Version:

Analyse file path and content to make search criteria for media APIs

20 lines (15 loc) 1.05 kB
import {makeHash} from "../../src"; describe('Make Hash', () => { test('should calculate correct hash from file of ba`s, size 123456789', () => { expect(makeHash(123456789, Promise.resolve('ba'.repeat(32*1024)), Promise.resolve('ba'.repeat(32*1024)))).resolves.toEqual('985898589fb44d15'); }); test('should calculate correct hash from file of ab`s, size 123456789', () => { expect(makeHash(123456789, Promise.resolve('ab'.repeat(32*1024)), Promise.resolve('ab'.repeat(32*1024)))).resolves.toEqual('589858985ff40d15'); }); test('should calculate correct hash from file of ba`s, size 987654321', () => { expect(makeHash(987654321, Promise.resolve('ba'.repeat(32*1024)), Promise.resolve('ba'.repeat(32*1024)))).resolves.toEqual('98589858d336e8b1'); }); test('should calculate correct hash from file of ab`s, size 987654321', () => { expect(makeHash(987654321, Promise.resolve('ab'.repeat(32*1024)), Promise.resolve('ab'.repeat(32*1024)))).resolves.toEqual('589858989376a8b1'); }); });