consul/ui/packages/consul-ui/tests/unit/utils/routing/wildcard-test.js

31 lines
733 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import wildcard from 'consul-ui/utils/routing/wildcard';
import { module, test } from 'qunit';
module('Unit | Utility | routing/wildcard', function () {
test('it finds a * in a path', function (assert) {
const isWildcard = wildcard({
route: {
_options: {
path: 'i-m-a-wildcard*',
},
},
});
assert.ok(isWildcard('route'));
});
test("it returns false without throwing if it doesn't find route", function (assert) {
const isWildcard = wildcard({
route: {
_options: {
path: 'i-m-a-wildcard*',
},
},
});
assert.notOk(isWildcard('not-route'));
});
});