cartodb-4.42/lib/assets/test/spec/cartodb/common/visualizations_fetch_model.spec.js
2024-04-06 05:25:13 +00:00

52 lines
1.3 KiB
JavaScript

var VisFetchModel = require('../../../../javascripts/cartodb/common/visualizations_fetch_model');
describe('common/visualizations_fetch_model', function() {
beforeEach(function() {
this.model = new VisFetchModel({
shared: false,
page: 1
});
});
describe('.isSearching', function() {
it('should return true if set to a search or tag query', function() {
this.model.set({
q: '',
tag: ''
});
expect(this.model.isSearching()).toBeFalsy();
this.model.set({
q: 'foobar',
tag: ''
});
expect(this.model.isSearching()).toBeTruthy();
this.model.set({
q: '',
tag: 'some-tag'
});
expect(this.model.isSearching()).toBeTruthy();
});
});
describe('.isDeepInsights', function() {
it('should return true if content_type is maps and deep-insights are enabled', function() {
this.model.set({
content_type: 'datasets',
deepInsights: true
});
expect(this.model.isDeepInsights()).toBeFalsy();
this.model.set({
content_type: 'maps'
});
expect(this.model.isDeepInsights()).toBeTruthy();
this.model.set({
deepInsights: false
});
expect(this.model.isDeepInsights()).toBeFalsy();
});
});
});