import { asyncFileRead } from '.';

describe('asyncFileRead', () => {
  it('should resolve with data64', async () => {
    const file = new Blob(['foo'], { type: 'text/plain' });
    await expect(asyncFileRead(file)).resolves.toBe('data:text/plain;base64,Zm9v');
  });

  it('should reject if  wrong file is given', async () => {
    const file = 'Not a blob';
    // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
    await expect(asyncFileRead(file as any)).rejects.toThrow();
  });
});
