From f6c6159a5c4a2803cf7df5bca194282b1c1dfc12 Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Mon, 13 May 2019 22:39:47 -0500 Subject: [PATCH] fix: use entity data for dist/ --- bin/build-entity-json-files.js | 4 ++-- lib/index.test.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/build-entity-json-files.js b/bin/build-entity-json-files.js index 1f02ec5..45ae065 100644 --- a/bin/build-entity-json-files.js +++ b/bin/build-entity-json-files.js @@ -15,7 +15,7 @@ function cleanStatsFromEntity(entity) { const sourceEntities = JSON5.parse(fs.readFileSync(`${DATA_DIR}/entities.json5`, 'utf8')) fs.writeFileSync(`${DIST_DIR}/entities.json`, JSON.stringify(sourceEntities)) -const httpArchiveData = require('../data/2019-03-01-origin-scripting.json') +const httpArchiveData = require('../data/2019-04-01-entity-scripting.json') const {getEntity} = require('../lib/index.js') // IMPORTANT: require this after entities have been written const entityExecutionStats = _(httpArchiveData) .groupBy(({origin}) => { @@ -47,5 +47,5 @@ fs.writeFileSync(`${DIST_DIR}/entities.json`, JSON.stringify(sourceEntities)) fs.writeFileSync(`${DIST_DIR}/entities-httparchive.json`, JSON.stringify(entitiesInHTTPArchive)) fs.writeFileSync( `${DIST_DIR}/entities-httparchive-nostats.json`, - JSON.stringify(entitiesInHTTPArchive.map(e => cleanStatsFromEntity(e))), + JSON.stringify(entitiesInHTTPArchive.map(e => cleanStatsFromEntity(e))) ) diff --git a/lib/index.test.js b/lib/index.test.js index a6e7cda..5283ff7 100644 --- a/lib/index.test.js +++ b/lib/index.test.js @@ -25,7 +25,7 @@ describe('getEntity', () => { it('works for direct domain usage', () => { expect(getEntity('https://js.connect.facebook.net/lib.js')).toMatchInlineSnapshot(` Object { - "averageExecutionTime": 119.80635511714381, + "averageExecutionTime": 142.3708560765058, "categories": Array [ "social", ], @@ -54,8 +54,8 @@ Object { ], "homepage": "https://www.facebook.com", "name": "Facebook", - "totalExecutionTime": 132167256, - "totalOccurrences": 1103174, + "totalExecutionTime": 144421993, + "totalOccurrences": 1014407, } `) }) @@ -63,7 +63,7 @@ Object { it('works for inferred domain usage', () => { expect(getEntity('https://unknown.typekit.net/fonts.css')).toMatchInlineSnapshot(` Object { - "averageExecutionTime": 95.1277705345502, + "averageExecutionTime": 91.7116918051686, "categories": Array [ "library", ], @@ -75,8 +75,8 @@ Object { ], "homepage": "https://fonts.adobe.com/", "name": "Adobe TypeKit", - "totalExecutionTime": 656667, - "totalOccurrences": 6903, + "totalExecutionTime": 954627, + "totalOccurrences": 10409, } `) })