Skip to content

Instantly share code, notes, and snippets.

@abargnesi
Created March 27, 2015 16:53
Show Gist options
  • Select an option

  • Save abargnesi/a5cb8d1ae896ddccc40e to your computer and use it in GitHub Desktop.

Select an option

Save abargnesi/a5cb8d1ae896ddccc40e to your computer and use it in GitHub Desktop.
spec
it('empty filter with facet', 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(100);
// 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 searchFactory = belhop.factory.options.search.custom;
var searchOptions = searchFactory(null, 0, 100, true);
console.log(searchOptions);
expect(belhop.evidence.search).toBeDefined();
belhop.evidence.search(searchOptions, cb);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment