How to use the file-type.mockReturnValue function in file-type

To help you get started, we’ve selected a few file-type examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Yoctol / bottender / src / cli / actions / __tests__ / uploadImages.spec.js View on Github external
it('call pushFile when checksum is different', async () => {
    const mockPushFile = jest.fn();

    hasha.fromFileSync = jest
      .fn()
      .mockReturnValueOnce('qazwsx')
      .mockReturnValueOnce('wsxedc');
    yoctolStatic.__setMockPushFile(mockPushFile);
    fileType.mockReturnValue({
      mime: 'image/png',
    });
    await uploadImages({ folderPath });
    expect(mockPushFile).toHaveBeenCalledTimes(2);
  });

file-type

Detect the file type of a Buffer/Uint8Array/ArrayBuffer

MIT
Latest version published 4 months ago

Package Health Score

90 / 100
Full package analysis