d509588cd2
Ember update - update ember-cli, ember-data, and ember to 3.4 series
29 lines
1 KiB
JavaScript
29 lines
1 KiB
JavaScript
import trimRight from 'vault/utils/trim-right';
|
|
import { module, test } from 'qunit';
|
|
|
|
module('Unit | Util | trim right', function() {
|
|
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');
|
|
});
|
|
});
|