open-vault/ui/tests/unit/helpers/dot-to-dash-test.js
Matthew Irish c31671ce04
Bug fix - ui context menu (#6018)
* add dot-to-dash helper

* fix context menu on policy page and add test for deletion

* use dot-to-dash where we use confirm component

* fix acceptance test
2019-01-09 12:30:19 -06:00

23 lines
677 B
JavaScript

import { dotToDash } from 'vault/helpers/dot-to-dash';
import { module, test } from 'qunit';
module('Unit | Helpers | dot-to-dash', function() {
test('it returns a string unchanged if there are not .s', function(assert) {
let string = 'foo';
let result = dotToDash([string]);
assert.equal(string, result);
});
test('it replaces a single . with -', function(assert) {
let string = 'foo.bar';
let result = dotToDash([string]);
assert.equal(result, 'foo-bar');
});
test('it replaces multiple . with -', function(assert) {
let string = 'foo.bar.baz';
let result = dotToDash([string]);
assert.equal(result, 'foo-bar-baz');
});
});