-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add tbody to contributors table (#307)
* refactor: add tbody to contributors table * chore(node): bump version to lts * fix(html): add correct indentation * test(url): fix bind error message Co-authored-by: Pierre Huyghe <[email protected]>
- Loading branch information
Showing
5 changed files
with
54 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
12.14.0 | ||
16.17.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,57 @@ | ||
import url from '../url'; | ||
import url from '../url' | ||
|
||
test(`Result of protocol validation should be true`, () => { | ||
expect(url.isHttpProtocol('http:')).toBe(true) | ||
expect(url.isHttpProtocol('https:')).toBe(true) | ||
expect(url.isHttpProtocol('http:')).toBe(true) | ||
expect(url.isHttpProtocol('https:')).toBe(true) | ||
}) | ||
|
||
test(`Result of protocol validation should be false`, () => { | ||
expect(url.isHttpProtocol('ftp:')).toBe(false) | ||
expect(url.isHttpProtocol('ftp:')).toBe(false) | ||
}) | ||
|
||
test(`Result of url validation should be true`, () => { | ||
expect(url.isValidHttpUrl('https://api.github.com/users/octocat')).toBe(true) | ||
expect(url.isValidHttpUrl('https://api.github.com/users/octocat')).toBe(true) | ||
}) | ||
|
||
test(`Result of url validation should be false when url uses wrong protocol`, () => { | ||
expect(url.isValidHttpUrl('git://[email protected]:all-contributors/all-contributors-cli.git')).toBe(false) | ||
expect( | ||
url.isValidHttpUrl( | ||
'git://[email protected]:all-contributors/all-contributors-cli.git', | ||
), | ||
).toBe(false) | ||
}) | ||
|
||
test(`Result of url validation should be false when input isn't url`, () => { | ||
expect(url.isValidHttpUrl('github-octocat')).toBe(false) | ||
expect(url.isValidHttpUrl('github-octocat')).toBe(false) | ||
}) | ||
|
||
test(`Result of parsed url should be equal`, () => { | ||
const input = 'https://api.github.com/users/octocat' | ||
const expected = 'https://api.github.com/users/octocat' | ||
expect(url.parseHttpUrl(input)).toBe(expected) | ||
const input = 'https://api.github.com/users/octocat' | ||
const expected = 'https://api.github.com/users/octocat' | ||
expect(url.parseHttpUrl(input)).toBe(expected) | ||
}) | ||
|
||
test(`Result of parsed url without protocol should be equal`, () => { | ||
const input = 'example.com' | ||
const expected = 'http://example.com/' | ||
expect(url.parseHttpUrl(input)).toBe(expected) | ||
const input = 'example.com' | ||
const expected = 'http://example.com/' | ||
expect(url.parseHttpUrl(input)).toBe(expected) | ||
}) | ||
|
||
test(`Throw an error when parsed input isn't a string`, () => { | ||
const input = 123 | ||
expect(url.parseHttpUrl.bind(null, input)).toThrowError('input must be a string') | ||
const input = 123 | ||
expect(url.parseHttpUrl.bind(null, input)).toThrowError( | ||
'input must be a string', | ||
) | ||
}) | ||
|
||
test(`Throw an error when parsed url has wrong protocol`, () => { | ||
const input = 'ftp://domain.xyz' | ||
expect(url.parseHttpUrl.bind(null, input)).toThrowError('Provided URL has an invalid protocol') | ||
const input = 'ftp://domain.xyz' | ||
expect(url.parseHttpUrl.bind(null, input)).toThrowError( | ||
'Provided URL has an invalid protocol', | ||
) | ||
}) | ||
|
||
test(`Throw an error when parsed input isn't a URL`, () => { | ||
const input = 'some string' | ||
expect(url.parseHttpUrl.bind(null, input)).toThrowError('Invalid URL: http://some string') | ||
const input = 'some string' | ||
expect(url.parseHttpUrl.bind(null, input)).toThrowError('Invalid URL') | ||
}) |