Created
March 27, 2015 15:49
-
-
Save abargnesi/fc10b859bdf469aa8ac2 to your computer and use it in GitHub Desktop.
Multiple filters in evidence search
This file contains hidden or 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
| /* global describe it expect belhop */ | |
| describe('belhop', function() { | |
| 'use strict'; | |
| var locations = []; | |
| var createdEvidence = null; | |
| var retrievedEvidence = null; | |
| var expected = null; | |
| var actual = null; | |
| var factory = null; | |
| describe('evidence', function() { | |
| it('use multiple filters', function(done) { | |
| var onSucc = function(response, status, xhr) { | |
| expect(xhr.status).toEqual(200); | |
| // docs say evidence and facets are in response object | |
| expect(response.evidence).toBeDefined(); | |
| expect(response.facets).toBeDefined(); | |
| // our options shouldn't return more than 20 things | |
| expect(response.evidence.length).not.toBeGreaterThan(200); | |
| // our options should include faceted responses | |
| expect(response.facets.length).toBeGreaterThan(0); | |
| done(); | |
| }; | |
| var onErr = function(xhr) { | |
| expect(xhr.status).toEqual(200); | |
| done(); | |
| }; | |
| var cb = belhop.factory.callback(onSucc, onErr); | |
| var filterFactory = belhop.factory.options.filter.custom; | |
| var filter1 = filterFactory('biological_context', 'Species', '9606'); | |
| var filter2 = filterFactory('metadata', 'status', 'Approved'); | |
| var filter3 = filterFactory('fts', 'search', 'nucleus'); | |
| var searchOptions = belhop.__.SearchOptions(0, 200, true, null); | |
| expect(belhop.evidence.search).toBeDefined(); | |
| belhop.evidence.search(searchOptions, cb, { | |
| filterOptions: [filter1, filter2, filter3] | |
| }); | |
| }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment