-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40a04ad
commit 4171f49
Showing
2 changed files
with
14 additions
and
0 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 |
---|---|---|
|
@@ -39,6 +39,11 @@ describe('getRootDomain', () => { | |
expect(getRootDomain('*.hulce.photography')).toEqual('hulce.photography') | ||
}) | ||
|
||
it('runs on *massive* inputs', () => { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
patrickhulce
Author
Owner
|
||
const massiveInput = '123456789'.repeat(100e3) | ||
expect(getRootDomain(massiveInput)).toEqual(null) | ||
}) | ||
|
||
it('throws on invalid inputs', () => { | ||
expect(() => getRootDomain('this is not a domain')).toThrow() | ||
expect(() => getRootDomain('neither-is-this')).toThrow() | ||
|
@@ -112,6 +117,11 @@ Object { | |
expect(getEntity('http://fbcdn-photos-e-a.akamaihd.net/1234.jpg').name).toEqual('Facebook') | ||
expect(getEntity('http://unknown.akamaihd.net/1234.jpg').name).toEqual('Akamai') | ||
}) | ||
|
||
it('runs on *massive* inputs', () => { | ||
const massiveInput = '123456789'.repeat(100e3) | ||
expect(getEntity(massiveInput)).toEqual(undefined) | ||
}) | ||
}) | ||
|
||
describe('build state', () => { | ||
|
Would it be useful to also assert that a (short) data URI results in the same behaviour?
E.g. something like
data:image/gif;base64,R0lGODlhAQABAIAAAP8AADAAACwAAAAAAQABAAACAkQBADs=
or
data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%228%22 height=%228%22 viewBox=%220 0 8 8%22%3E %3Ccircle cx=%224%22 cy=%224%22 r=%222%22/%3E %3Ca xmlns:xlink=%22http://www.w3.org/1999/xlink%22 xlink:title=%22%3F%3E%22%3Etest%3C/a%3E %3C/svg%3E
These, I think, should not be considered third-party requests (GoogleChrome/lighthouse#9834).
The code now handles that correctly, but just wondering about test coverage. I'd be interested in submitting a patch if so :)