-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit test #40
Open
Solinca
wants to merge
18
commits into
Wizcorp:master
Choose a base branch
from
Solinca:unit-test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Unit test #40
Changes from 14 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
29254e2
Update dependencies to use jeff cli with node 6
Solinca ede67ec
Setting up unit tests
Solinca 9fb0b95
Cover SwfObjectProcessor addClassNames method
Solinca 0c2dd57
Cover SwfObjectProcessor createSymbols method
Solinca 801e062
Little refactor on createSymbols.js ( I made sure it was still workin…
Solinca aaec7f6
Remove sinon cause I don't need sandboxes ( no XHR call in unit test )
Solinca a1ed47d
Pass unit tests to devDependencies and add Istanbul for code coverage
Solinca 1be8793
More coverage thanks to Istanbul
Solinca 5a1ff14
100% coverage on SwfObjectProcessor/createSymbols.js
Solinca 7cdf64d
Cover SwfObjectProcessor removeSymbols method
Solinca 9c22898
Make Remove Symbols tests more granular
Solinca e9c5b93
Declare some const for every sub test on Remove Symbols
Solinca 5d4080e
Add some toughness on removeSymbols.js
Solinca 9774b6c
Add some test for removeSymbols to cover the added toughness
Solinca 27a7cdc
Simplify npm scripts
Solinca 02d1717
Separate all unit tests into 3 files
Solinca a29ce28
Remove monkey test
Solinca 9dae435
Clean refactor
Solinca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -2,3 +2,5 @@ test | |
test-output | ||
npm-debug.log | ||
node_modules | ||
coverage | ||
.idea |
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 |
---|---|---|
@@ -1,30 +1,40 @@ | ||
'use strict'; | ||
|
||
function removeSymbols(symbols, classSymbols, removeList){ | ||
var nbClassSymbols = classSymbols.length; | ||
for (var s = 0; s < nbClassSymbols; s += 1) { | ||
|
||
var classSymbol = classSymbols[s]; | ||
if (!classSymbol || !classSymbol.children) { | ||
continue; | ||
} | ||
|
||
var children = classSymbol.children; | ||
for (var c = 0; c < children.length; c += 1) { | ||
|
||
var child = children[c]; | ||
var symbol = symbols[child.id]; | ||
if (!symbol.className){ | ||
continue; | ||
} | ||
|
||
var idx = removeList.indexOf(symbol.className); | ||
if (idx !== -1) { | ||
children.splice(c, 1); | ||
c -= 1; | ||
} | ||
} | ||
} | ||
function removeSymbols(symbols, classSymbols, removeList) { | ||
var nbClassSymbols = classSymbols.length; | ||
|
||
for (var s = 0; s < nbClassSymbols; s++) { | ||
var classSymbol = classSymbols[s]; | ||
|
||
if (!classSymbol || !classSymbol.children) { | ||
continue; | ||
} | ||
|
||
var children = classSymbol.children; | ||
|
||
for (var c = 0; c < children.length; c++) { | ||
var child = children[c]; | ||
|
||
if (!child || typeof child.id === "undefined") { | ||
continue; | ||
} | ||
|
||
var symbol = symbols[child.id]; | ||
|
||
if (!symbol || !symbol.className) { | ||
continue; | ||
} | ||
|
||
if (removeList && removeList.length > 0) { | ||
var idx = removeList.indexOf(symbol.className); | ||
|
||
if (idx !== -1) { | ||
children.splice(c, 1); | ||
c -= 1; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
module.exports = removeSymbols; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually we are putting all the test files inside a
test/
folderin that case you can simplify the npm scripts:
find
all the test filesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right!
I already put all my tests into an "unit-tests" folder.
My unit test setup file was located on root before I removed it, this is the reason why I wrote those line.
I will apply these changes