Skip to content

Commit

Permalink
Test for preparing BEM entity before apply filters
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKashlakov committed Jul 4, 2016
1 parent 1e02782 commit 6ab90b6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# bem-tools-find

[![NPM version](http://img.shields.io/npm/v/bem-tools-find.svg?style=flat)](http://www.npmjs.org/package/bem-tools-find)
[![Build Status](https://travis-ci.org/bem-incubator/bem-tools-find.svg)](https://travis-ci.org/bem-incubator/bem-tools-find)
[![Coverage Status](https://coveralls.io/repos/bem-incubator/bem-tools-find/badge.svg?branch=master&service=github)](https://coveralls.io/github/bem-incubator/bem-tools-find?branch=master)
[![David](https://img.shields.io/david/bem-incubator/bem-tools-find.svg)](https://david-dm.org/bem-incubator/bem-tools-find)
[![Build Status](https://travis-ci.org/bem-contrib/bem-tools-find.svg)](https://travis-ci.org/bem-contrib/bem-tools-find)
[![Coverage Status](https://coveralls.io/repos/bem-contrib/bem-tools-find/badge.svg?branch=master&service=github)](https://coveralls.io/github/bem-contrib/bem-tools-find?branch=master)
[![David](https://img.shields.io/david/bem-contrib/bem-tools-find.svg)](https://david-dm.org/bem-contrib/bem-tools-find)

![Logo](./logo.ico)

Expand Down
26 changes: 26 additions & 0 deletions test/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,31 @@ describe('util', function() {
it('should return result with apply function', function() {
assert.instanceOf(util.getFiltersForConditions().apply, Function);
});

it('should prepare BEM entity before apply filter', function() {
var Filter = require('../../lib/filter');
sinon.stub(Filter.prototype, 'apply', function() {
return true;
});
var apply = util.getFiltersForConditions({
blocks: ['foo'],
levels: [],
modifiers: [],
elements: [],
techs: []
}).apply;
apply({
entity: {
block: 'foo'
},
tech: 'js'
});
assert.equal(Filter.prototype.apply.calledOnce, true);
assert.equal(Filter.prototype.apply.calledWith({
block: 'foo',
tech: 'js'
}), true);
Filter.prototype.apply.restore();
});
});
});

0 comments on commit 6ab90b6

Please sign in to comment.