Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should call parseList if the coercion_type is List', function () {
var filter = {
coercion_type: 'List',
property_value: ['a list']
};
var stub = sinon.stub(FormatUtils, 'parseList');
FilterValidations.property_value.validate(filter);
assert.isTrue(stub.calledWith(filter.property_value));
FormatUtils.parseList.restore();
});
it('should run the geo validations if the coercion_type is Geo', function () {
it('should call FilterUtils.queryJSON for every filter', function () {
var step = { filters: [{}, {}, {}] };
var stub = sinon.stub(FilterUtils, 'queryJSON');
FunnelUtils.stepJSON(step);
assert.lengthOf(stub.getCalls(), 3);
FilterUtils.queryJSON.restore();
});
});
function getProps(props) {
var props = props || {};
var defaults = {
index: 0,
canRemove: true,
step: TestHelpers.createStep(),
eventCollections: [],
propertyNames: [],
onBrowseEvents: sinon.stub(),
moveStep: sinon.stub(),
removeStep: sinon.stub(),
handleChange: sinon.stub(),
toggleStepActive: sinon.stub(),
handleFilterChange: sinon.stub(),
handleAddFilter: sinon.stub(),
handleRemoveFilter: sinon.stub(),
getPropertyType: sinon.stub()
};
return _.assign({}, defaults, props);
}
beforeEach(function() {
this.handleChangeStub = sinon.stub();
this.removeFilterStub = sinon.stub();
this.defaultProps = {
key: 0,
index: 0,
filter: {
property_name: 'name',
operator: 'eq',
property_value: 'value',
coercion_type: 'String',
isValid: true,
errors: []
},
propertyType: 'String',
eventCollection: 'click',
propertyNames: [
'one',
function defaultProps() {
return {
eventCollection: null,
filters: [],
handleChange: sinon.stub(),
removeFilter: sinon.stub(),
addFilter: sinon.stub(),
getPropertyType: sinon.stub().returns('String'),
propertyNames: []
};
}
function getProps(props) {
var props = props || {};
var defaults = {
modelId: 'abc123',
steps: [],
onBrowseEvents: sinon.stub(),
eventCollections: [],
stepNotices: [],
getEventPropertyNames: sinon.stub().returns([]),
getPropertyType: sinon.stub().returns('String')
};
return _.assign({}, defaults, props);
}
function getProps(props) {
var props = props || {};
var defaults = {
index: 0,
canRemove: true,
step: TestHelpers.createStep(),
eventCollections: [],
propertyNames: [],
onBrowseEvents: sinon.stub(),
moveStep: sinon.stub(),
removeStep: sinon.stub(),
handleChange: sinon.stub(),
toggleStepActive: sinon.stub(),
handleFilterChange: sinon.stub(),
handleAddFilter: sinon.stub(),
handleRemoveFilter: sinon.stub(),
getPropertyType: sinon.stub()
};
return _.assign({}, defaults, props);
}
function getProps(props) {
var props = props || {};
var defaults = {
index: 0,
canRemove: true,
step: TestHelpers.createStep(),
eventCollections: [],
propertyNames: [],
onBrowseEvents: sinon.stub(),
moveStep: sinon.stub(),
removeStep: sinon.stub(),
handleChange: sinon.stub(),
toggleStepActive: sinon.stub(),
handleFilterChange: sinon.stub(),
handleAddFilter: sinon.stub(),
handleRemoveFilter: sinon.stub(),
getPropertyType: sinon.stub()
};
return _.assign({}, defaults, props);
}
before(function(){
this.runQueryStub = sinon.stub(ExplorerUtils, 'runQuery');
sinon.stub(ProjectActions, 'fetchCollectionSchema');
});