mirror of
https://github.com/hashicorp/vault.git
synced 2025-09-02 12:31:08 +02:00
* remove dev-leased-kv flag, handle non-secret responses in the console * skip lease tests for now * use the newer collection api for ember-page-object * include generic in types that can have a v2 * add tests for generic v2 * isolate kv v2 logic in the secret-engine model and add unit tests
29 lines
1019 B
JavaScript
29 lines
1019 B
JavaScript
import trimRight from 'vault/utils/trim-right';
|
|
import { module, test } from 'qunit';
|
|
|
|
module('Unit | Util | trim right');
|
|
|
|
test('it trims extension array from end of string', function(assert) {
|
|
const trimmedName = trimRight('my-file-name-is-cool.json', ['.json', '.txt', '.hcl', '.policy']);
|
|
|
|
assert.equal(trimmedName, 'my-file-name-is-cool');
|
|
});
|
|
|
|
test('it only trims extension array from the very end of string', function(assert) {
|
|
const trimmedName = trimRight('my-file-name.json-is-cool.json', ['.json', '.txt', '.hcl', '.policy']);
|
|
|
|
assert.equal(trimmedName, 'my-file-name.json-is-cool');
|
|
});
|
|
|
|
test('it returns string as is if trim array is empty', function(assert) {
|
|
const trimmedName = trimRight('my-file-name-is-cool.json', []);
|
|
|
|
assert.equal(trimmedName, 'my-file-name-is-cool.json');
|
|
});
|
|
|
|
test('it returns string as is if trim array is not passed in', function(assert) {
|
|
const trimmedName = trimRight('my-file-name-is-cool.json');
|
|
|
|
assert.equal(trimmedName, 'my-file-name-is-cool.json');
|
|
});
|