Clean up some things

This commit is contained in:
Ken-Håvard Lieng 2018-05-25 04:12:02 +02:00
parent e2a895a1b9
commit e7cff1686e
9 changed files with 121 additions and 135 deletions

View file

@ -1,5 +1,5 @@
import React from 'react';
import { isChannel, isValidNick, isValidChannel, isValidUsername, isInt } from '..';
import { isChannel, isValidNick, isValidChannel, isValidUsername } from '..';
import linkify from '../linkify';
describe('isChannel()', () => {
@ -76,22 +76,6 @@ describe('isValidUsername()', () => {
));
});
describe('isInt()', () => {
it('validates integers', () => {
expect(isInt('0')).toBe(true);
expect(isInt('1337')).toBe(true);
expect(isInt('0', 0, 65535)).toBe(true);
expect(isInt('0', 1, 65535)).toBe(false);
expect(isInt('1', 1, 65535)).toBe(true);
expect(isInt('65535', 1, 65535)).toBe(true);
expect(isInt('00065535', 1, 65535)).toBe(true);
expect(isInt('65536', 1, 65535)).toBe(false);
expect(isInt('1cake', 1, 65535)).toBe(false);
expect(isInt('cake1', 1, 65535)).toBe(false);
expect(isInt('', 1, 65535)).toBe(false);
});
});
describe('linkify()', () => {
const proto = href => (href.indexOf('http') !== 0 ? `http://${href}` : href);
const linkTo = href => (