This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 975
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9582 from brave/9581
Optimize top site order lookups
- Loading branch information
Showing
3 changed files
with
49 additions
and
8 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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
/* global describe, it */ | ||
|
||
const assert = require('assert') | ||
|
||
require('../../../braveUnit') | ||
const {topSites, getSiteOrder} = require('../../../../../app/common/data/topSites') | ||
|
||
describe('topSites', function () { | ||
describe('topSites', function () { | ||
it('exports an array with top sites', function () { | ||
assert.equal(topSites.constructor, Array) | ||
assert.ok(topSites.length > 0) | ||
assert.equal(topSites[0], 'google.com') | ||
}) | ||
}) | ||
describe('getSiteOrder', function () { | ||
it('obtains the first site\'s order', function () { | ||
assert.equal(getSiteOrder('google.com'), 1) | ||
}) | ||
it('obtains an arbigrary site\'s order', function () { | ||
assert.equal(getSiteOrder('calendar.google.com'), 4) | ||
}) | ||
it('orders unknown sites as max int', function () { | ||
assert.equal(getSiteOrder('bradhatesprimes.com'), 9007199254740991) | ||
}) | ||
}) | ||
}) |