-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Written tests for contains, in_array and getDomainFromUrl.
- Loading branch information
Mario Basic
committed
Jun 30, 2015
1 parent
12b153b
commit 9598a53
Showing
4 changed files
with
32 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ function contains(line, list) { | |
if(cleanLine === '') continue; | ||
|
||
// If line contains the clean line return true | ||
if (line.indexOf(cleanLine) > - 1) { | ||
if (cleanLine.indexOf(line) > - 1) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
alanhamlett
Member
|
||
return true; | ||
} | ||
} | ||
|
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 |
---|---|---|
|
@@ -7,4 +7,18 @@ describe('contains', function() { | |
it('should be a function', function() { | ||
expect(contains).to.be.a('function'); | ||
}); | ||
|
||
it('should find the line and return true', function() { | ||
This comment has been minimized.
Sorry, something went wrong.
dboczek
|
||
|
||
var list = ".app\ntest.com"; | ||
|
||
expect(contains('.app', list)).to.equal(true); | ||
}); | ||
|
||
it('should not find the line and it should return false', function() { | ||
|
||
var list = ".app\ntest.com"; | ||
|
||
expect(contains('.app2', list)).to.equal(false); | ||
}); | ||
}); |
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
I think this code was ok before. Line can be:
https://example.com/aaa/bbb/ccc
and whitelist
It should search for whitelisted line in url not opposite otherwise we have to put all urls into whitelist instead on domain only.
The problem is that tests are not correct. See my other comments.