-
Notifications
You must be signed in to change notification settings - Fork 111
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 #606 from olgn/fix-603
Fix 603
- Loading branch information
Showing
2 changed files
with
83 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
const assert = require('chai').assert | ||
const { collect39Issues } = require('../headerFields') | ||
|
||
describe('headerFields', () => { | ||
describe('collect39Issues()', () => { | ||
it('should return an empty array if there are no files in allIssues39Dict', () => { | ||
const allIssues39Dict = {} | ||
const issues = collect39Issues(allIssues39Dict) | ||
assert.isArray(issues) | ||
assert.lengthOf(issues, 0) | ||
}) | ||
it('should return one issue per file in the allIssues39Dict', () => { | ||
const allIssues39Dict = { | ||
file_1: [ | ||
{ | ||
code: 39, | ||
reason: 'for some reason', | ||
}, | ||
{ | ||
code: 39, | ||
reason: 'for some other reason', | ||
}, | ||
], | ||
} | ||
const issues = collect39Issues(allIssues39Dict) | ||
assert.isArray(issues) | ||
assert.lengthOf(issues, 1) | ||
}) | ||
it('should return one issue for each file with code 39 issues', () => { | ||
const allIssues39Dict = { | ||
file_1: [ | ||
{ | ||
code: 39, | ||
reason: 'reason1', | ||
}, | ||
], | ||
file_2: [ | ||
{ | ||
code: 39, | ||
reason: 'reason2', | ||
}, | ||
], | ||
} | ||
const issues = collect39Issues(allIssues39Dict) | ||
assert.lengthOf(issues, 2) | ||
}) | ||
it('constructs a combined reason string from each issue.reason of a file', () => { | ||
const allIssues39Dict = { | ||
file_1: [ | ||
{ | ||
code: 39, | ||
reason: 'reason1', | ||
}, | ||
{ | ||
code: 39, | ||
reason: 'reason2', | ||
}, | ||
], | ||
} | ||
const issues = collect39Issues(allIssues39Dict) | ||
assert.lengthOf(issues, 1) | ||
assert(issues[0].reason == ' reason1 reason2') | ||
}) | ||
}) | ||
}) |
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