-
Notifications
You must be signed in to change notification settings - Fork 8
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 #42 from atom-ide-community/independent-tree
- Loading branch information
Showing
8 changed files
with
303 additions
and
69 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
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,11 @@ | ||
const { ArrayFilterer } = require('../fuzzaldrin-dist') | ||
|
||
describe('ArrayFilterer', function () { | ||
it('is possible to set candidates only once and filter multiple times', function(){ | ||
const arrayFilterer = new ArrayFilterer() | ||
arrayFilterer.setCandidates(['Call', 'Me', 'Maybe']) // set candidates only once | ||
// call filter multiple times | ||
expect(arrayFilterer.filter('me')).toEqual(['Me', 'Maybe']) | ||
expect(arrayFilterer.filter('all')).toEqual(['Call']) | ||
}) | ||
}); |
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,36 @@ | ||
const { TreeFilterer } = require("../fuzzaldrin-dist") | ||
const DeepEqual = require('deep-equal'); | ||
|
||
describe("ArrayFilterer", function() { | ||
it('is possible to set candidates only once and filter multiple times', function() { | ||
|
||
const arrayFilterer = new TreeFilterer() | ||
|
||
const candidates = [ | ||
{data: "bye1", children: [{data: "hello"}]}, | ||
{data: "Bye2", children: [{data: "_bye4"}, {data: "hel"}]}, | ||
{data: "eye"}, | ||
] | ||
arrayFilterer.setCandidates(candidates, "data", "children") // set candidates only once | ||
|
||
|
||
// call filter multiple times | ||
|
||
expect(DeepEqual( | ||
arrayFilterer.filter('hello'), | ||
[ { data: 'hello', index: 0, level: 1 } ] | ||
)).toBe(true) | ||
|
||
|
||
expect(DeepEqual( | ||
arrayFilterer.filter('bye'), | ||
[ | ||
{ data: 'bye1', index: 0, level: 0 }, | ||
{ data: '_bye4', index: 0, level: 1 }, | ||
{ data: 'Bye2', index: 1, level: 0 } | ||
] | ||
)).toBe(true) | ||
|
||
|
||
}) | ||
}) |
Oops, something went wrong.