open-vault/ui/tests/unit/helpers/is-wildcard-string-test.js
Angel Garbarino 382a519756
Ui/transform info table row roles (#9942)
* add dynamic segement to list-root so that you can sepecify the tab you want to go to

* create new info-table-item-array component to handle array items passed into a info-table

* do not underline links if they are in an info-table-row confirmed with design

* implement the InfoTableItemArray component

* amend wildcard helper to take in regular string

* setup the logic and more logic

* fix routing to roles issue

* test for new component

* change data-test-mode to count

* handle case when wildcardCount is 0
2020-09-15 12:11:24 -06:00

41 lines
1.4 KiB
JavaScript

import { isWildcardString } from 'vault/helpers/is-wildcard-string';
import { module, test } from 'qunit';
module('Unit | Helpers | is-wildcard-string', function() {
test('it returns true if regular string with wildcard', function(assert) {
let string = 'foom#*eep';
let result = isWildcardString(string);
assert.equal(result, true);
});
test('it returns false if no wildcard', function(assert) {
let string = 'foo.bar';
let result = isWildcardString(string);
assert.equal(result, false);
});
test('it returns true if string with id as in searchSelect selected has wildcard', function(assert) {
let string = { id: 'foo.bar*baz' };
let result = isWildcardString(string);
assert.equal(result, true);
});
test('it returns true if string object has name and no id', function(assert) {
let string = { name: 'foo.bar*baz' };
let result = isWildcardString(string);
assert.equal(result, true);
});
test('it returns true if string object has name and id with at least one wildcard', function(assert) {
let string = { id: '7*', name: 'seven' };
let result = isWildcardString(string);
assert.equal(result, true);
});
test('it returns true if string object has name and id with wildcard in name not id', function(assert) {
let string = { id: '7', name: 'sev*n' };
let result = isWildcardString(string);
assert.equal(result, true);
});
});