-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix category parsing of quoted headers (#51)
* Add a test for category parsing * Update category parser to handle quoted headers.
- Loading branch information
1 parent
4d842a2
commit d8f044f
Showing
3 changed files
with
40 additions
and
20 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const assert = require('assert') | ||
const {describe, it, before} = require('mocha') | ||
const { getCategories } = require('../src/trackers/helpers/getCategory') | ||
|
||
describe('getCategories', () => { | ||
it('generates a domain/category map', () => { | ||
const domainToCategpry = getCategories('test/fixtures/categorized_trackers.csv') | ||
assert.deepStrictEqual(domainToCategpry, { | ||
'ads.com': { | ||
'First Category': 1, | ||
'Advertising': 1, | ||
}, | ||
'example.com': { | ||
'First Category': 0, | ||
'Advertising': 1, | ||
} | ||
}) | ||
}) | ||
}) | ||
|
||
|
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,3 @@ | ||
domain,"First Category",Advertising | ||
example.com,,1 | ||
ads.com,1,1 |