Skip to content

Commit

Permalink
Add tests for whitelist and blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilbielawski committed Oct 15, 2014
1 parent 0e2b24d commit 8fd0662
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,22 @@ describe('franc()', function () {
assert(franc(fixture) === 'jpn');
}
);
});

it('should accept blacklist parameter', function () {
var lang = franc(fixtures[42]),
opts = {
blacklist : [lang]
};
assert.notEqual(franc(fixtures[42], opts), lang);
});

it('should accept whitelist parameter', function () {
var opts = {
whitelist : ['pol']
};
assert(franc(fixtures[42], opts) === 'pol');
});
});
describe('franc.all()', function () {
it('should be of type `function`', function () {
assert(typeof franc.all === 'function');
Expand Down Expand Up @@ -99,6 +113,24 @@ describe('franc.all()', function () {
assert(result[1][0] === 'eng');
assert(result[1].length === 2);
});

it('should accept blacklist parameter', function () {
var lang = franc(fixtures[42]),
opts = {
blacklist : [lang]
},
res = franc.all(fixtures[42], opts);
for (var l in res) {
assert.notEqual(res[l][0], lang);
}
});

it('should accept whitelist parameter', function () {
var opts = {
whitelist : ['pol']
};
assert(franc.all(fixtures[42], opts)[0][0] === 'pol');
});
});

describe('algorithm', function () {
Expand Down

0 comments on commit 8fd0662

Please sign in to comment.