Valeriia Ruban 663a5642c2
[UI]: update Ember to 3.27 (#16227)
* Upgrade to 3.25 via ember-cli-update

* v3.25.3...v3.26.1

* v3.26.1...v3.27.0


Co-authored-by: Michael Klein <michael@firstiwaslike.com>
2023-02-10 13:32:19 -08:00

84 lines
1.9 KiB
JavaScript

import { module, test } from 'qunit';
import ExactSearch from 'consul-ui/utils/search/exact';
import predicates from 'consul-ui/search/predicates/intention';
module('Unit | Search | Predicate | intention', function () {
test('items are found by properties', function (assert) {
const actual = new ExactSearch(
[
{
SourceName: 'Hit',
DestinationName: 'destination',
},
{
SourceName: 'source',
DestinationName: 'destination',
},
{
SourceName: 'source',
DestinationName: 'hiT',
},
],
{
finders: predicates,
}
).search('hit');
assert.equal(actual.length, 2);
});
test('items are not found', function (assert) {
const actual = new ExactSearch(
[
{
SourceName: 'source',
DestinationName: 'destination',
},
],
{
finders: predicates,
}
).search('hit');
assert.equal(actual.length, 0);
});
test('items are found by *', function (assert) {
const actual = new ExactSearch(
[
{
SourceName: '*',
DestinationName: 'destination',
},
{
SourceName: 'source',
DestinationName: '*',
},
],
{
finders: predicates,
}
).search('*');
assert.equal(actual.length, 2);
});
test("* items are found by searching anything in 'All Services (*)'", function (assert) {
assert.expect(6);
const actual = new ExactSearch(
[
{
SourceName: '*',
DestinationName: 'destination',
},
{
SourceName: 'source',
DestinationName: '*',
},
],
{
finders: predicates,
}
);
['All Services (*)', 'SerVices', '(*)', '*', 'vIces', 'lL Ser'].forEach((term) => {
assert.equal(actual.search(term).length, 2);
});
});
});