docbrown/app/javascript/article-form/components/__tests__/pasteImageHelpers.test.jsx
Andrew Bone 9ef1534d83
Add paste image (#10212)
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
Co-authored-by: Nick Taylor <nick@dev.to>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-02-04 10:58:56 -05:00

29 lines
1 KiB
JavaScript

import { matchesDataTransferType } from '../pasteImageHelpers';
describe('pasteImageHelpers', () => {
describe('matchesDataTransferType', () => {
it('returns false if no types are provided', () => {
expect(matchesDataTransferType([])).toBe(false);
});
it('returns true if at least one type matches Files', () => {
const result = matchesDataTransferType(['example', 'Files', 'other']);
expect(result).toBe(true);
});
it('returns false if no types match type Files', () => {
const result = matchesDataTransferType(['example', 'other']);
expect(result).toBe(false);
});
it('returns true if at least one type matches a custom type provided', () => {
const result = matchesDataTransferType(['example', 'other'], 'other');
expect(result).toBe(true);
});
it('returns false if no types match a custom type provided', () => {
const result = matchesDataTransferType(['example', 'Files'], 'other');
expect(result).toBe(false);
});
});
});