1 | var path = require('path');
|
2 | var sinon = require('sinon');
|
3 | var chai = require('chai');
|
4 | var expect = chai.expect;
|
5 | var testFramework = require('../index');
|
6 | var filters = testFramework.filters;
|
7 | var tests = [];
|
8 |
|
9 | 'a b c'.split(' ').forEach(function(f) {
|
10 |
|
11 | for (var i = 0; i < 2; i++) {
|
12 | tests.push({filename: 'path/to/' + f + '.js'});
|
13 | }
|
14 | });
|
15 |
|
16 | describe('single test filter', function() {
|
17 | beforeEach(function() {
|
18 | sinon.stub(path, 'resolve', function(path) {
|
19 | return path;
|
20 | });
|
21 | });
|
22 |
|
23 | afterEach(function() {
|
24 | path.resolve.restore();
|
25 | });
|
26 |
|
27 | it('returns the tests matching the given file', function() {
|
28 | var filtered = filters.test(tests, 'path/to/b.js');
|
29 | expect(filtered).to.have.length(2);
|
30 | expect(filtered[0]).to.have.property('filename').that.equals('path/to/b.js');
|
31 | });
|
32 | });
|