ghost-keychain/packages/extension-base/src/utils/isXmlOrPdf.test.tsx
Thibaut Sardan ae9227ef6d
Add phishing site detection, redirection and information (#488)
* missing type declarations for @polkadot/phishing

* phishing landing page

* Update packages/extension-base/src/background/types.ts

* wording make it short

* fix build

* add test for xml pdf utils

* fix export

* Update packages/extension-base/src/utils/isXmlOrPdf.ts

* use Trans from i18n

* alpha ordering

* i18nKey

* lint

* move pdf and xml detection to enable to prevent unwanted redirection

* styled component refactoring

* import odering

* remove a css hack :)

Co-authored-by: Github Actions <action@github.com>
2020-10-13 14:14:55 +02:00

24 lines
596 B
TypeScript

// Copyright 2019-2020 @polkadot/extension-ui authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { isXmlOrPdf } from './';
describe.only('File extension util function', () => {
it('returns true for a xml file', () => {
const res = isXmlOrPdf('/some.xml');
expect(res).toBe(true);
});
it('returns true for a pdf file', () => {
const res = isXmlOrPdf('/some.pdf');
expect(res).toBe(true);
});
it('returns false for any other path', () => {
expect(isXmlOrPdf('/some-pdf')).toBe(false);
expect(isXmlOrPdf('/some-xml')).toBe(false);
});
});