vault/ui/tests/unit/helpers/is-wildcard-string-test.js
Angel Garbarino d42547842a
Ui/transform find all roles (#9879)
* setup wild card helper and call the helper inside the search select component

* change to wildcardLabel instead of wildCardLabel to keep consistent with usage

* clean up errors

* add wilcard functionality to roles

* add tooltip delete functionality

* move cli command to computed property too complicated for template and it didn't cover everything

* edit modal on transformation when there's a role

* make small adjustments based on logic confusion on my end

* use brace expansion

* fixes

* filter-wildcard helper test

* is-wildcard-string-test

* search select test

* check for empty array

* nest conditional so wildcard helper doesn't get called uncessarily

* remove wildcard from roles

* refactor a little

* clean up wildcard helper and test
2020-09-08 10:53:51 -06:00

35 lines
1.2 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 with at least one wildcard', function(assert) {
let string = { id: '7*', name: 'seven' };
let result = isWildcardString([string]);
assert.equal(result, true);
});
});