import getPredicate from 'consul-ui/search/predicates/intention';
import { module, test } from 'qunit';
module('Unit | Search | Predicate | intention', function() {
const predicate = getPredicate();
test('items are found by properties', function(assert) {
[
{
SourceName: 'Hit',
DestinationName: 'destination',
},
SourceName: 'source',
DestinationName: 'hiT',
].forEach(function(item) {
const actual = predicate('hit')(item);
assert.ok(actual);
});
test('items are not found', function(assert) {
const actual = predicate('*')(item);
assert.notOk(actual);
test('items are found by *', function(assert) {
SourceName: '*',
DestinationName: '*',
test("* items are found by searching anything in 'All Services (*)'", function(assert) {
['All Services (*)', 'SerVices', '(*)', '*', 'vIces', 'lL Ser'].forEach(function(term) {
const actual = predicate(term)(item);