Solr.spec.js
1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
define(function(require) {
'use strict';
var _ = require('underscore');
var Backbone = require('backbone');
var Solr = require('solr/model/Solr');
var SolrTestData = require('solr/model/Solr.spec.data');
describe('Solr', function() {
it('loads', function() {
expect(Solr).toBeDefined();
});
describe('construct', function() {
var s;
var origNow;
var facets;
var modelFacet, modelItems;
beforeEach(function() {
jasmine.clock().install();
jasmine.clock().mockDate();
origNow = _.now;
_.now = function() { return new Date().getTime(); };
spyOn(Backbone, 'ajax');
s = new (SolrTestData.testSearchBuilder())();
facets = s.get('facets');
modelFacet = facets.get('model');
modelItems = modelFacet.get('items');
});
afterEach(function() {
jasmine.clock().uninstall();
_.now = origNow;
});
it('initial values', function() {
expect(Backbone.ajax).not.toHaveBeenCalled();
expect(modelItems.length).toBe(0);
});
describe('initial debounce', function() {
beforeEach(function() {
jasmine.clock().tick(300);
});
it('foo', function() {
expect(Backbone.ajax).not.toHaveBeenCalled();
});
});
describe('click facet', function() {
beforeEach(function() {
});
it('not searched', function() {
});
});
});
});
});